Solved

org.hibernate.NonUniqueObjectException

Posted on 2013-01-07
1
363 Views
Last Modified: 2013-01-17
Hi All,

Please advise on what we should do to prevent the following exception.

-10.60.5.39-8643-8) MKOCO95200M42Q0 : a different object with the same identifier value was already associated with the session: web.enrollment.bean.organization.EnrollmentAccomodationsBean#308: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: web.enrollment.bean.organization.EnrollmentAccomodationsBean#308
0
Comment
Question by:somaghoshCU
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
ivanovn earned 300 total points
ID: 38764767
The Java objects and Hibernate objects are handled differently. In this case, you have opened a hibernate session and associated an object to that identifier. So when you try to merge in a new java object within the same hibernate session, that identifier is already used in hibernate cache and you get that exception.

What you should do is either complete the merge of the initial object and close or clear the session, or evict the hibernate object from the cache before reusing the identifier.

Chapter 11 of the documentation contains most of the information you need:
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/ch11.html

For the rest of the documentation see:
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html/
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
A solution for Fortify Path Manipulation.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question