-->
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: Accessing a id generator
PostPosted: Fri Mar 24, 2006 9:26 am 
Beginner
Beginner

Joined: Mon May 02, 2005 6:17 pm
Posts: 41
Is this possible? I need to access id generator declared in mapping from my code.
Thanks

_________________
www.globalresearch.ca


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 11:43 am 
Regular
Regular

Joined: Tue Dec 09, 2003 2:39 pm
Posts: 106
Location: Toronto, Canada
You can take a look at the org.hibernate.id package. It should contain all that you need.

Don't forget to rate ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 12:16 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
do you need some handle to the "generator" or are you interested in just getting the "ID" that is assigned to the record?

if the first, then perhaps something off of
"configuration" object when you create the SessionFactory.

The second would be had, but simply issuing the session.save(object) - the ID is assigned at this point, and the actual insert is not given to the DB until the flush() or commit() - so you can see the ID prior to insert.

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 12:49 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
Also check out Interceptor

chapter 12:

http://www.hibernate.org/hib_docs/v3/re ... erence.pdf

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 11, 2006 7:48 am 
Beginner
Beginner

Joined: Mon May 02, 2005 6:17 pm
Posts: 41
I needed to get a handle on a generator but we solved it buy inheriting a hibernates generator. We performed save operation manually so we needed to set id's to object somehow.

_________________
www.globalresearch.ca


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.