-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: composite-id
PostPosted: Thu Oct 05, 2006 8:42 am 
Newbie

Joined: Thu Oct 05, 2006 8:32 am
Posts: 7
Hibernate version:3

Name and version of the database you are using: Postgree

How I do hibernate mapping when one of the fields of the composite-id is a sequence ??? The sequence I can do into "generator", that is into of "id".But in this case, I use <key-property>, and it dont work with "generator".
Can Someone help me? I m brazilian, sorry the bad english..rs


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 4:28 pm 
Newbie

Joined: Tue Sep 19, 2006 7:07 pm
Posts: 9
How can you have sequence for composite key? As I know, sequence are objects in Database that retrieve a single value. The id of your class don't represent the PK on your table? I think there's something wrong on your model. Give more details...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 8:01 am 
Newbie

Joined: Thu Oct 05, 2006 8:32 am
Posts: 7
My PK has two fields: one is integer....and the other too......
id_hist (integer)
id_subprod (integer)

but id_hist I want as a auto-increment....in Postgree...I have to have a sequence....

please helpe-me


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 8:22 am 
Regular
Regular

Joined: Mon May 08, 2006 6:00 am
Posts: 53
Location: India
You do have a work around of having your own id generator....

basically this id generator should execute following SQL and should give you id

select sequencename.nextval from dual.

you can refer to documentation from the site or example given in book for working with composite id for the same

sudhir


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 11:44 am 
Newbie

Joined: Thu Oct 05, 2006 8:32 am
Posts: 7
Where I can insert this code? (select sequencename.nextval from dual)
I think this is exactly I want....

If you have some topic or link about it, tell me please.

thank


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.