Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When I have a complex id within an unenhanced MappedSuperClass, I get a NPE when calling persist. The NPE appears to be caused because ClassMetaData.getField(int) does not take unenhanced MappedSuperclass fields into account. Here is the stack trace:
<openjpa-0.0.0-r420667:564688M nonfatal general error> org.apache.openjpa.persistence.PersistenceException: null
at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2437)
at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2251)
at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1010)
at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541)
at org.apache.openjpa.enhance.TestUnenhancedCompoundPKSubclass.compoundPKHelper(TestUnenhancedCompoundPKSubclass.java:46)
at org.apache.openjpa.enhance.TestUnenhancedCompoundPKSubclass.testCompoundPKFieldAccessUserDefined(TestUnenhancedCompoundPKSubclass.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
Caused by: java.lang.NullPointerException
at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.retrieve(ApplicationIds.java:568)
at org.apache.openjpa.util.ApplicationIds$PrimaryKeyFieldManager.fetchIntField(ApplicationIds.java:537)
at org.apache.openjpa.enhance.org$apache$openjpa$enhance$UnenhancedCompoundPKFieldAccessSubclass$pcsubclass.pcCopyKeyFieldsToObjectId(Unknown Source)
at org.apache.openjpa.enhance.PCRegistry.copyKeyFieldsToObjectId(PCRegistry.java:160)
at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:185)
at org.apache.openjpa.enhance.ReflectingPersistenceCapable.pcNewObjectIdInstance(ReflectingPersistenceCapable.java:257)
at org.apache.openjpa.util.ApplicationIds.create(ApplicationIds.java:384)
at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2405)
... 23 more
Attached is a test case that reproduces the NPE. The test methods have been disabled as to not break the build.
Attachments
Attachments
Issue Links
- blocks
-
OPENEJB-628 Unenhanced JPA support with OpenJPA
- Closed