|Behaviour of nested UnitOfWork [message #1808442]
||Mon, 24 June 2019 17:09
| thorsten kruse
Registered: October 2017
Hi, I noticed some unexpected behaviour, look at this. Read an Employee, create a new Adress, delete all adresses and the Employee:|
UnitOfWork uow = getSomeNewUnitOfWork();
Employee bob = ReadEmp("Bob") and create a new Adress for Bob.
UnitOfWork uowN = uow.acquireUnitOfWork();
Employee bobN = uowN.registerObject(bob);
printAllAdresses(bobN); //result is as expected, the new Adress is present
printAllAdresses(bobN); // no adress listed
printAllAdresses(bob); // no adress listed
Bob and the old adresses are deleted, but the new adress is inserted to DB. To my mind, this is a bug. What do you think?
Debugging with stop after uowN.commit(); you can see instance bob has still the new adress. If Bob (bobN) is not deleted everything works fine.
UnitOfWorkImpl.commitNestedUnitOfWork calling mergeChangesIntoParent() does not work correctly. I will open a bug.
[Updated on: Tue, 25 June 2019 10:23]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01822 seconds