When I use merge after delete in same transaction
for example:
Code:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session = sessionFactory.openSession();
Person p1 = new Person(10,"aaaa");
session.merge(p1.getClass().getName(),p1);
Transaction tnx = session.beginTransaction();
Person p = new Person(10,"aaaa");
Object res =session.merge(p.getClass().getName(),p);
session.delete(res);
session.merge(p.getClass().getName(),p1);
tnx.commit();
I get following exception:
org.hibernate.ObjectDeletedException: The object with that id was deleted: [com.alex.hibernate.Person#10]
Any idea ???
Thanks,
Alex