-->
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: generate assigned
PostPosted: Wed Feb 28, 2007 3:22 pm 
Newbie

Joined: Wed Feb 28, 2007 2:56 pm
Posts: 6
Hi,

I'm new to hibernate, I've tried to find out a solution in user guide and FAQ but couldn't answer my question.

I use 'generate assigned' to define id before inserting new rows into some tables of my database. Everything works fine when I deal with existing id (saveOrUpdate performs an update) or if I don't define any id (it is in this case generated and, then, saveOrUpdate performs an insert).
But sometimes I'd like to insert new rows and give new id by myself, not using the generation function. If I set my Id before calling saveOrUpdate, my object having a defined id, hibernate tries to perform an update and my data is not inserted.

Is there a way to tell hibernate when failing to update a data to insert it? Or should I create a specific Interceptor?

Thank you for your answers. I hope my message is clear enough. I'm french so please excuse my english...


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.