cascade-remove bug with UOW [message #1069862] |
Tue, 16 July 2013 15:03  |
Eclipse User |
|
|
|
I know this a 'strange scenario' but due to an ongoing migration, I am using Eclipselink JPA (V2.5) but obtaining a UnitOfWork from the EntityManager using the implementation classes. I then delete an object using the uow:
((org.eclipse.persistence.jpa.JpaEntityManager) entityManager.getDelegate()).getUnitOfWork();
uow.deleteObject(o)
The Object model is mapped using JPA XML mapping files, and I know the correct implementation is:
And I am 'lowly migrating a large code base to follow this design.
However, the two approaches give very different results! The XML mapping files state <cascade-all> and / or <cascade-remove> for all relationships. However, when using the uow to delete an object the removes are not cascaded, but when using the entityManager they are - orphan deletion still functions the same in both scenarios.
I don't know if this is a bug, because I don't know if the uow approach is actually supported. My goal is to convert all of the code base to use entityManagers, and the difference in behavior is actually working in my favour - because the existing (Native Eclipse legacy code) code behaves exactly the same as it did before regardless of whether <cascade-remove> is set or not, and we only need to consider remove semantics as the querying / manager bean code for each POJO is converted to proper JPA syntax
|
|
|
|
Re: cascade-remove bug with UOW [message #1069880 is a reply to message #1069873] |
Tue, 16 July 2013 15:42  |
Eclipse User |
|
|
|
Chris...
Thanks, now it makes sense.
Like I said, I like they way it currently behaves, and it means I don't have to change any of my xml mappings cascade settings until I migrate the individual manager beans that are doing the deletions.
|
|
|
Powered by
FUDForum. Page generated in 0.04669 seconds