-->
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.  [ 4 posts ] 
Author Message
 Post subject: Eagerly generating identifiers
PostPosted: Tue May 11, 2004 5:36 pm 
Newbie

Joined: Thu May 06, 2004 2:57 pm
Posts: 7
There are a few cases in my application where it would be helpful to generate identifiers for my objects before saving them to the database.

Does anyone have suggestions on how this can be done with hibernate?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 8:45 am 
Newbie

Joined: Wed May 12, 2004 8:14 am
Posts: 4
Location: Gaborone
Have you tried using the "assigned" generator-class for the objects that you want to create id's for? Or i misundestood your question?


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 11:31 am 
Newbie

Joined: Thu May 06, 2004 2:57 pm
Posts: 7
Ideally, I'd like to keep using hibernate to generate the keys for me. What I was hoping for was a way to ask hibernate to assign identifiers to everything without actually committing the transaction.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 12, 2004 4:10 pm 
Beginner
Beginner

Joined: Thu Jan 22, 2004 8:22 pm
Posts: 48
I beleive flushing the session generates the ids but doesn't commit the transaction. It does update/insert to the database as required and that could be a liability depending on your reason for wanting to get the ids now.


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