persistence@glassfish.java.net

Issue 315: Deleting from a managed relationship

From: Scott Oaks <Scott.Oaks_at_Sun.COM>
Date: Wed, 01 Mar 2006 15:30:26 -0500

At the joint Oracle/Sun meeting today, I was asked to summarize this
issue for the mailing list.

We have a Customer object, which has a ManyToOne relationship to
CustomerInventory. This series of operations are executed:

start transaction
find Customer
find CustomerInventory
remove CustomerInventory
end transaction

start transaction
find Customer
navigate through Customer to the CustomerInventory collection;
   it still contains the deleted object
end transaction

The question, I believe, boils down to this: is the application
responsible for updating the customer object (calling
setCustomerInventory() with the new array) to prevent this, or should
the second transaction read only committed data (hence performing a
refresh in the background).

I believe that it is Linda's position that the new transaction should
read only committed data and that it is Oracle's position that the
application must update the customer object. Both sensible positions,
but somewhat in conflict :-)

-Scott