Hibernate not using schema and catalog name in id generation with strategy increment

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-04-01T10:26:27Z Indexed on 2010/04/11 15:23 UTC
Read the original article Hit count: 249

Filed under:
|
|
|

Hi,

I am using the hibernate increment strategy to create my IDs on my entities.

@GenericGenerator(name="increment-strategy", strategy="increment")
@Id @GeneratedValue(generator="increment=strategy")
@Column(name="HDR_ID", unique=true, nullable=false)
public int getHdrId(){
     return this.hdrId;
}

The entity has the following table annotation

@Table(name = "PORDER.PUB.PO_HEADER", schema = "UVOSi", catalog = "VIRT_UVOS")

Please note I have two datasources.

When I try to insert an entity Hibernate creates the following SQL statement: select max(hdr_id) from PORDER.PUB.PO_HEADER which causes the following error: Group specified is ambiguous, resubmit the query by fully qualifying group name.

When I create a query by hand with entityManager.createQuery() hibernate uses the fully qualified name

select XXX from VIRT_UVOS.UVOSi.PORDER.PUB.PO_HEADER

and that works fine. So how do I get Hibernate to use the fully qualified name in the Id autogeneration?

Btw. I am using Hibernate 3.2 and Seam 2.2 running on JBoss 4.2.3

Regards

Immo

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about seam