datanucleus-core icon indicating copy to clipboard operation
datanucleus-core copied to clipboard

Enhancement contract : Embedded PK has incomplete dnCopyKeyFieldsXXX methods

Open andyjefferson opened this issue 8 years ago • 0 comments

When enhancing a class marked as @Embeddable the class is enhanced, however its jdoCopyKeyFieldsXXX methods are not set (empty body) and so the key fields are not copied.

This is tested by "test.jpa.general" EmbeddedTest. When calling clean(...) this tries to use the SQL DELETE FROM ... WHERE ... = ... yet the PK values are not set. This is because AppIDObjectIdFieldConsumer is created and passed to Department.jdoCopyKeyFieldsFromObjectId, which calls AppIDObjectIdFieldConsumer.storeObjectField(...) with the DepartmentPK. This then calls DepartmentPK.jdoCopyKeyFieldsFromObjectId(...) which does nothing!

andyjefferson avatar Apr 11 '16 07:04 andyjefferson