openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pawel Veselov <>
Subject temporary entity left in the database after being deleted.
Date Thu, 29 Dec 2011 11:46:54 GMT

I'm not sure what I'm doing wrong here. I'm creating a temporary entity,
within transaction, deleting the entity before committing. I need that
temporary entity in the database during the transaction though... My code
is roughly doing this:

EntityManager em; // have it
E_App temp = new E_App();
// the temporary entity is in the database, as I wanted (verified)
// do other crazy stuff now, not touching temp instance in any way
// (except from side direct DB queries that don't modify any managed
em.flush(); // I added that line in hope it might make a difference, but it
// some other stuff, also changes persistence context

The problem is that temp shows up in the database after commit.

There is a statement in the spec that says that if you call remove() on a
new entity, it's a no-op. I agree it should be, but I don't think new and
merged entity qualifies for being "new". I tried to trace this down, and
from what I can see, BrokerImpl.delete(Object,OpCallbacks) gets <null> from
getStateManagerImpl() for that object, passing it as a second arg into
delete(Object, StateManagerImpl, OpCallbacks), which effectively makes it a

Thank you,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message