unexpected behavior using refreshAndLockObject [message #639324] |
Tue, 16 November 2010 00:34  |
Eclipse User |
|
|
|
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?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03453 seconds