|NOT NULL FK nullification problem [message #1243377]
||Mon, 10 February 2014 23:02
| Thom Park
Registered: June 2012
Is there any way to suppress eclipselink's shallow update/delete behavior where it nulls any foreign keys detected for a particular mapped entity?|
By way of explanation:
I have a mature existing schema that is accessed via JDBC and eclipselink (2.0.2) clients.
Ideally, I'd like to bring the eclipselink portion up to the very latest release as a stepping stone to enabling JPA compliant behavior. However I've encountered a bit of an issue.
Eclipselink 2.5.1 nulls out any Foreign keys in a parent entity if a cyclic relationship is detected (basically prior to performing the delete or update operation on the child/related entities).
My problem is two-fold:
- Not all FKs contribute to the cyclic relationship
- Some of the FKs are defined as not-null in order to maintain a mandatory relationship (1:1 as opposed to 0:1)
The not null constraint is needed to enforce integrity for the JDBC clients rather than the eclipselink clients, but since the database schema is shared, I can't just relax the constraint without risking issues.
So - is there any way to suppress the nullification of the FKs in eclipselink?
I did see seem code in the OneToOneMapping implementation that appeared to check to see if the underlying column was nullable but that doesn't appear to have any bearing on the generation of the update statement that nulls out the foreign-key in the table.
Any thoughts out there on how best to fix this?
(either with eclipse link mapping or otherwise)?
Note: This application is still using TopLInk-style mappings, not JPA annotations - I'm unable to move to JPA just yet, hence the attempt to bring the release up to 2.5.1.
Powered by FUDForum
. Page generated in 0.19428 seconds