Solved

org.hibernate.NonUniqueObjectException

Posted on 2013-01-07
1
354 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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.
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.

734 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