Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

Refreshing detached entities

No1UNo

2010-03-11

Replies: Find Java Web Hosting

Author LoginPost Reply

Possible gap in my understanding, but I would expect an exception in this case based on section 3.2.5 of the JPA 2.0 specification: "If [entity] X is new, detached, or removed entity, the IllegalArgumentException is thrown".

try {
 TestEntity refreshDetached = new TestEntity("refresh detached");
 em.persist(refreshDetached);
 em.flush();
 em.detach(refreshDetached);
 em.refresh(refreshDetached);
 logger.error("ERROR: No exception from em.refresh(detached)");
} catch (IllegalArgumentException e) {
 logger.info("SUCCESS: Refresh detached");
} catch (Exception e) {
 logger.error("ERROR: Unexpected exception from em.refresh(detached): " + e.toString());
}

ERROR: No exception from em.refresh(detached)


©2008 gg3721.com - Jax Systems, LLC, U.S.A.