Reputation: 91
I have a question:
In spring mvc using hibernate(session hibernate) I get object1, and right after that I want to get a list of objects which is the previously obiek1, and I get an error:
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session...
how to merg this object in one session?
My code to get list:
Criteria crit = session.getCurrentSession().createCriteria(Object1.class);
crit.add(Restrictions.eq("status", 1));
return crit.list();
I must open new session to get list?
Upvotes: 1
Views: 2497
Reputation: 2702
@kuka11 : Using session.merge(object)
would be usefull. Read this article.
Upvotes: 0