You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2007/08/21 01:19:31 UTC

[jira] Resolved: (OPENJPA-314) Unenhanced complex id in MappedSuperclass causes NPE

     [ https://issues.apache.org/jira/browse/OPENJPA-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey resolved OPENJPA-314.
-------------------------------------

    Resolution: Fixed

> Unenhanced complex id in MappedSuperclass causes NPE
> ----------------------------------------------------
>
>                 Key: OPENJPA-314
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-314
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>            Reporter: Dain Sundstrom
>             Fix For: 1.0.0
>
>         Attachments: OPENJPA-314.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.