i have a Hibernate APP we are trying to implement Open Session in View Pattern
with ZK i have a question Hibernate creates a session per thread and closes it but we have severals operations with [criteria and save or update] methods in one session we started to implement using update method we very quickly received the infamous
NONUNIQUEOBJECTEXCEPTION
we have changed update()
to merge()
my question if the following.
if i have a Student
class and trying to update the the student using update[making sure is not in session avoid the exception]
but later in other method the student is required to updated again differently from the previous update
this time we should merging
and merge()
method is called. i was wondering when [flush][commit]
method is called the changes to the first student is loss? the changes to the both students is OK? what happens??
i am afraid the changes in the first student
is loss! what can i do in this case?
thanks a lot a best regards.