Hello all,
I am doing following activity in my applicatin -
1. Fetch object using getHibernateTemplate().get(String entityName, Object obj).
2. If in step #1, object is present in database, then call getHibernateTemplate().delete(String entityName, Object id).
3. Fetch object using getHibernateTemplate().get(String entityName, Object obj), so it will give null.
4. Populate object with same property having by object in step #1.
5. Call getHibernateTemplate().saveOrUpdate(String entityName, Object obj). passed object was populated in step #4.
On executing step #5, I am getting exception- a different object with the same identifier value was already associated with the session
Please note that all steps from #1 to #5 are part of single transaction.
Could you please advice me to handle this exception.
Thanks in advance.