According to the test case your send to me i wrote the following method
without success :
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public Company getTestCompany(long id) {
OpenJPAEntityManager jpaEm = OpenJPAPersistence.cast(em);
jpaEm.clear();
Company found = jpaEm.find(Company.class, id);
if (!jpaEm.contains(found)) throw new
IllegalStateException("entity not in
manager!");
if (jpaEm.isDetached(found)) throw new
IllegalStateException("entity
should not be detached yet");
logger.info("Detaching...");
Company detached = jpaEm.detach(found);
logger.info("Detaching...done ");
if (!jpaEm.isDetached(found)) throw new
IllegalStateException("entity
should be detached");
return detached;
}
It throws an exception "entity shoul be detached". The return value
(detached) is not considered as detached !
--
View this message in context:
http://n2.nabble.com/How-to-unenhance-entities-tp4749734p4752055.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.