title: Hibernate Error: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session
body: <p>I have two user Objects and while I try to save the object using </p>
  
  <pre><code>session.save(userObj);
  </code></pre>
  
  <p>I am getting the following error:</p>
  
  <pre><code>Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session:
  [com.pojo.rtrequests.User#com.pojo.rtrequests.User@d079b40b]
  </code></pre>
  
  <p>I am creating the session using </p>
  
  <pre><code>BaseHibernateDAO dao = new BaseHibernateDAO();          
  
  rtsession = dao.getSession(userData.getRegion(),
                             BaseHibernateDAO.RTREQUESTS_DATABASE_NAME);
  
  rttrans = rtsession.beginTransaction();
  rttrans.begin();
  
  rtsession.save(userObj1);
  rtsession.save(userObj2);
  
  rtsession.flush();
  rttrans.commit();
  
  rtsession.close(); // in finally block
  </code></pre>
  
  <p>I also tried doing the <code>session.clear()</code> before saving, still no luck.</p>
  
  <p>This is for the first I am getting the session object when a user request comes, so I am getting why is saying that object is present in session.</p>
  
  <p>Any suggestions?</p>