-->
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.  [ 1 post ] 
Author Message
 Post subject: Override Generator (sequence) on session.save()
PostPosted: Thu May 28, 2009 12:26 am 
Beginner
Beginner

Joined: Thu May 18, 2006 2:58 pm
Posts: 28
After another day of searching and a new set of eyes, I found the answer: Googled:
Quote:
migrate hibernate session save
and found this: https://forum.hibernate.org/viewtopic.php?f=1&t=959631&start=0

The save method in the current documentation (http://docs.jboss.org/hibernate/stable/core/reference/en/html/objectstate-makingpersistent.html) describes the Deprecated Session.save method that is now in the org.hibernate.classic package.

I found the link here in the forum that suggests using session.replicate when all the fields are set with known values to insert.

See here for details.
https://forum.hibernate.org/viewtopic.php?f=1&t=959631&start=0


For more information see:
https://forum.hibernate.org/viewtopic.php?f=1&t=957045&view=previous
http://www.hibernate.org/250.html - Hibernate3 Migration Guide


Original Post Below:
To All:

I am looking for a way to override the sequence generator on a session.save()

I want to be able to assign an id (like the default assigned strategy) sometimes, and have the sequence assign the id at other times.

Is this possible?

I see the method declaration in the documentation is different from what is described in this post:
Code:
Serializable save(String entityName, Object object)
          Persist the given transient instance, first assigning a generated identifier.


Is the entityName the property of the id?
Will it use the value of that property in object?

I'm trying to provide a primary key instead of having the generated one saved (in this case generated from a trigger)

Can the generator be overridden?

Thanks.

see here from other post (posted in nhibernate inadvertantly)
https://forum.hibernate.org/viewtopic.php?f=25&t=983700


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

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.