-->
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: Attributing a PK before commit
PostPosted: Fri Sep 26, 2003 8:33 am 
Newbie

Joined: Mon Sep 01, 2003 1:22 pm
Posts: 16
Location: France
Hi,

I was wondering if there is any way to ask Hibernate to assign the primary key to an object that is going to be created before the transaction commit. I'm creating an object in a transaction and need its id before commit, so that I can use it in the same transaction. I could flush the session but that would break my transaction, which would defeat the original purpose.

If this feature isn't supported yet, do you think it would be simple enough to implement it ? I figured that the id attribution could take place outside of the transaction as losing one or two increments in a sequence in case of rollback is usually not really important. What do you think ?

Thanks,
Matt.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 26, 2003 9:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
primary keys are assigned immediately when save() is called.


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.