Hibernate not using schema and catalog name in id generation with strategy increment
- by Ben
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