Hibernate session method to update object
Posted
by EugeneP
on Stack Overflow
See other posts from Stack Overflow
or by EugeneP
Published on 2010-04-05T09:01:09Z
Indexed on
2010/04/05
9:03 UTC
Read the original article
Hit count: 254
I need this roadmap of a Hibernate managed object instance.
First, I create an instance with initial properties and persist this object in a db. Then session associated with this object is closed. But still, I serialize my object and on the next step deserialize it, invoke some setters, and again, I need to update what changed in a database.
What methods of Hibernate session should I use? persist() or save() on the first step and saveOrUpdate() on the second?
In fact I see that saveOrUpdate() can be used on each step.
What would you recommend?
© Stack Overflow or respective owner