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...
|