Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » unexpected behavior using refreshAndLockObject (refreshAndLockObject does not work with Indirection)
unexpected behavior using refreshAndLockObject [message #639324] Tue, 16 November 2010 00:34 Go to next message
Eclipse UserFriend
I came across a strange case today which seems worth sharing with the community. I would greatly appreciate any feedback and comments to help explain this behavior

Setup
LabOrder (1 - many) LabTestResult [using transparent indirection]
LabTestResult (1 - 1) LabOrder [using ValueHolder]

Case

// LabTestResult labTestResult was previously read from the session

UnitOfWork uow = session.acquireUnitOfWork();
LabTestResult ltr_clone = (LabTestResult) uow.refreshAndLockObject(labTestResult);
System.out.println(ltr_clone.getEdiUpdate()); // This prints NULL which is the current value in the DB

ltr_clone.setEdiUpdate(dt);
System.out.println(ltr_clone.getEdiUpdate()); // This prints dt which was just set

ltr_clone.getLabOrder().getLabTestResultSet().size();
System.out.println(ltr_clone.getEdiUpdate()); // This prints NULL [why?]

uow.commit(); // Finds nothing to commit


Question is why EL is refreshing the contents of the ltr_clone while executing the transparent indirection query?
Re: unexpected behavior using refreshAndLockObject [message #639422 is a reply to message #639324] Tue, 16 November 2010 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

This is the result of the refresh cascading over references. This should only occur though if a relationship is privately owned, as the refreshAndLockObject method marks the query's cascade value to CascadePrivateParts.

Do you have both relationships marked as privately owned? You should make one of them owned by the other, not both.

Best Regards,
Chris
Re: unexpected behavior using refreshAndLockObject [message #639616 is a reply to message #639422] Wed, 17 November 2010 03:26 Go to previous message
Eclipse UserFriend
Chris,

Thank you for looking into this!

Only one of the relationships is privately owned.

LabOrder (1 - many) LabTestResult [using transparent indirection] [privately owned]

Would that still explain the behavior?

Tony
Previous Topic:[EclipseLink 2.1.1 / SDO] DataGraph Support
Next Topic:Null Property persisted with value Zero
Goto Forum:
  


Current Time: Sun Jul 06 07:54:11 EDT 2025

Powered by FUDForum. Page generated in 0.03453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top