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.  [ 2 posts ] 
Author Message
 Post subject: assigning id's to an object with generator class "sequence"
PostPosted: Mon Mar 01, 2010 11:09 am 
Newbie

Joined: Sun Jul 01, 2007 12:15 pm
Posts: 7
Location: Philippines
If i assign an id to an object with a generator id class of type "sequence", will hibernate use the id I assigned or will it still generate a new id when I insert into the DB?


Top
 Profile  
 
 Post subject: Re: assigning id's to an object with generator class "sequence"
PostPosted: Mon Mar 01, 2010 12:10 pm 
Beginner
Beginner

Joined: Tue Aug 25, 2009 11:42 am
Posts: 49
Hibernate will assign one and ignore the one u assigned. (But I am wondering, instead of asking the question, why would u not write sample codes and experiment with it yourself?)

U might want to consider "sequence-identity", which is "a specialized sequence generation strategy that utilizes a database sequence for the actual value generation, but combines this with JDBC3 getGeneratedKeys to return the generated identifier value as part of the insert statement execution. This strategy is only supported on Oracle 10g drivers targeted for JDK 1.4. Comments on these insert statements are disabled due to a bug in the Oracle drivers."

Also note the "unsaved-value" property (which could be : null|any|none|undefined|id_value) of the <id> tag. It *used to be* important for versions of Hibernate earlier than 3.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.