openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JayaPrakash <>
Subject Not Refreshing after delete
Date Tue, 04 Aug 2009 17:09:48 GMT


     We have an application built on OpenJPA and we see a very peculiar
problem. We have two domain classes Parent and Child and has a OneToMany
relationship from Parent to Child and ManyToOne relationship from Child to
Parent. Also there are multiple foreign key relationship between these two
tables on the DB side, however we have relationship only on one column in
our domain classes as mentioned earlier. The problem here is that when we
merge the Object tree and the DB deletes the Child rows because of cascade
effect on the DB side, OpenJPA still fetches the deleted row as if it was
there in the DB. I check in the DB and to my surprise the row is already

To avoid this I did a em.refresh(Object) and it throws an Exception saying
the Entity (That was deleted is not found. I guess this is because the DB
does not have the record and the OpenJPA EM has the record.) is not found. I
never faced this before, the OpenJPA EM always has the refreshed Object tree
from DB. It was always in Sync with the DB never out of Sync.

Please suggest if any configuration changes needs to be made to force the
OpenJPA to be in Sync with DB.

View this message in context:
Sent from the OpenJPA Developers mailing list archive at

View raw message