Hi,
According to EBJ3 specification of persist method
Quote:
If X is a removed entity, it becomes managed.
I should be able to call persist(entity) immediate after remove(entity), but I'm receiving exception instead.
The code looks like this (em is an EntityManager):
Code:
Test t = new Test();
em.persist(t);
em.getTransaction().begin();
em.getTransaction().commit();
em.close();
em = GetEntityManager();
t = em.merge(t);
em.remove(t);
em.persist(t) <- here I got the exception
The Test class is just a simple entity with ID only.
I'm using the newest hibernate version with in SE environment.
The exception message is:
Quote:
Exception in thread "main" javax.persistence.EntityNotFoundException: deleted entity passed to persist:
Any help appreciated.