Cloning and Unit Of Work
I have asked this question years ago and unfortunately I dont remember the answer.
When I do the following code
Employee employee = new Employee();
Employee empClone = (Employee)uow.registerObject(employee);
Does TopLink Unit Of Work framework clone the dependent objects of Employee as well or only the primary object i.e. Employee and its direct fields only ? Say Employee had a Vector of PhoneNumbers. Do the phone number objects get cloned as well ?
Thanks and apologies if its a FAQ. If somebody could point me to the relevant URL that would be more than sufficient.
The UnitOfWork will clone all reachable objects to form a complete isolated graph of objects for the scope of the transaction. This is minimized with indirection. When a relationship is reached that uses indirection (lazy loading) then the associated object(s) are not cloned until requested.