You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (JIRA)" <ji...@apache.org> on 2008/10/24 19:45:44 UTC

[jira] Commented: (OPENJPA-752) ProxySetupStateManager.setProxyData routing through PersistanceCapable caused "PersistenceException: null"

    [ https://issues.apache.org/jira/browse/OPENJPA-752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12642502#action_12642502 ] 

Albert Lee commented on OPENJPA-752:
------------------------------------

The use case is:

- An entity inherits from 2 nested super classes
       EntityVersionedA -> BaseVersionEntity -> BaseNonVersionEntity
- The entities are packaged in 2 different jar files
- The persistence.xml reference one of the jar file in the persistence unit's <jar-file>

Since not all entities are packaged in the same jar file, resolving metadata of these class hierarchy do not build correctly in the ClassMetaData's attribue "_allFields". This field contains fewer number of attributes in the corresponding persistence capable class. However the enhancer was able to detect all the fields based of Reflection, hence there is a mis-matched attribute table list between the ClassMetaData and the enhanced class. As a result, the interaction between the ProxySetupStateManager and the PersistenceCapable class route the method call to the wrong indexed provide*Field method.

This problem may only occur if there is Calendar, Collection or Map object defined in an entity.

The cause of the exception is basically incorrect packaging, a better exception message will go a long way to help application to correct the problem.

Albert Lee.

> ProxySetupStateManager.setProxyData routing through PersistanceCapable caused "PersistenceException: null"
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-752
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-752
>             Project: OpenJPA
>          Issue Type: Improvement
>          Components: kernel
>    Affects Versions: 1.0.3, 1.1.0, 1.2.0, 1.3.0
>            Reporter: Albert Lee
>            Assignee: Albert Lee
>            Priority: Minor
>             Fix For: 1.0.4, 1.2.1, 1.3.0
>
>         Attachments: OPENJPA-752.test.jar
>
>
> The symptom of the problem is an InternalException is thrown from ProxySetupStateManager.provide*Field method due to mismatched routing to a PersistenceCapable object: The stack will look like something similar to this:
> Exception in thread "main" <openjpa-1.0.3-SNAPSHOT-r420667:649224M fatal user error> org.apache.openjpa.persistence.ArgumentException: Errors encountered while resolving metadata.  See nested exceptions for details.
>         at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:522)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)
>         at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1060)
>         at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:252)
>         at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:347)
>         at test.Main.main(Main.java:16)
> Caused by: <openjpa-1.0.3-SNAPSHOT-r420667:649224M fatal general error> org.apache.openjpa.persistence.PersistenceException: null
>         at org.apache.openjpa.meta.ProxySetupStateManager.providedBooleanField(ProxySetupStateManager.java:206)
>         at test.BaseNonVersionEntity.pcProvideField(BaseNonVersionEntity.java)
>         at test.BaseVersionEntity.pcProvideField(BaseVersionEntity.java)
>         at test.EntityVersionedA.pcProvideField(EntityVersionedA.java)
>         at org.apache.openjpa.meta.ProxySetupStateManager.setProxyData(ProxySetupStateManager.java:62)
>         at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1731)
>         at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1613)
>         at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:675)
>         at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:575)
>         at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:500)
>         ... 5 more
> NestedThrowables:
> <openjpa-1.0.3-SNAPSHOT-r420667:649224M fatal user error> org.apache.openjpa.persistence.ArgumentException: Unable to resolve type "test.EntityNonVersionedM" due to previous errors resolving related type "test.EntityVersionedA".
>         at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:689)
>         at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:575)
>         at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:500)
>         at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:302)
>         at org.apache.openjpa.kernel.BrokerImpl.newObjectId(BrokerImpl.java:1060)
>         at org.apache.openjpa.kernel.DelegatingBroker.newObjectId(DelegatingBroker.java:252)
>         at org.apache.openjpa.persistence.EntityManagerImpl.find(EntityManagerImpl.java:347)
>         at test.Main.main(Main.java:16)
> I shall attach a test case later.
> Albert Lee.

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