-->
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: Create of new record of existing entity
PostPosted: Thu Aug 10, 2006 10:57 am 
Newbie

Joined: Tue Mar 21, 2006 4:19 am
Posts: 15
Hi Guys! I have a bean retrieved from the data base, i modify it and want to create a new record with the modified bean but when i invoke save() method, Hibernate creates an update query. How to make it create insert query?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 10, 2006 1:14 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Hibernate decides whether to insert or update based on the existence of the id (at least in the case of an identity column key), so setting the id to null (or whatever you have set as your "unsaved-value" attribute) should cause an insert.

Curtis ...

_________________
---- Don't forget to rate! ----


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.