After a frustrating time building a test project to isolate what I thought was a new issue, I discovered that there was nothing wrong with my project, I had just forgotten to add one entity class to the PCEnhancer command during my build-time enhancement routine.

So the class was unenhanced.

With RuntimeUnenhancedClasses set to unsupported, instead of receiving a "cannot run with unenhanced classes" error, OpenJPA threw the exceptions below.

I think this definitely qualifies as a bug - OpenJPA is throwing the wrong exception. It definitely misled me for a while.

Shall I open a JIRA for it?


Regards
Adam


Adam Hardy on 08/02/09 23:46, wrote:
Following on from my initial response, I copied the superclass into the same project so that the enhancer can process the class file properly.

It looks like I'm taking the scenic route around all the OpenJPA issues right now.

I hit this problem with enhanced files that doesn't happen with the unenhanced.

I carefully set the property openjpa.RuntimeUnenhancedClasses=unsupported so I can be certain I am running with the enhanced classes.

So with build-time enhancement, I get stacktraces of exceptions as follows, although it's not clear which is the original cause:

Caused by: java.lang.IllegalStateException: No registered metadata for type "class org.permacode.patternrepo.domain.entity.CollatedRun". at org.apache.openjpa.enhance.PCRegistry.getMeta(PCRegistry.java:255)

NestedThrowables:
<openjpa-1.2.0-r422266:683325 fatal user error> org.apache.openjpa.persistence.ArgumentException: Unable to resolve type "org.permacode.patternrepo.domain.entity.TestAnalysis" due to previous errors resolving related type "org.permacode.patternrepo.domain.entity.CollatedRun". at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:731)

<openjpa-1.2.0-r422266:683325 fatal user error> org.apache.openjpa.persistence.ArgumentException: Unable to resolve type "org.permacode.patternrepo.domain.entity.Weighting" due to previous errors resolving related type "org.permacode.patternrepo.domain.entity.CollatedRun". at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:731)

<openjpa-1.2.0-r422266:683325 fatal user error> org.apache.openjpa.persistence.ArgumentException: Attempt to map "org.permacode.patternrepo.domain.entity.CollatedRun.portfolio" failed: the owning entity is not mapped. at org.apache.openjpa.jdbc.meta.MappingInfo.assertTable(MappingInfo.java:547)

java.lang.IllegalStateException: No registered metadata for type "class org.permacode.patternrepo.domain.entity.CollatedRun". at org.apache.openjpa.enhance.PCRegistry.getMeta(PCRegistry.java:255)


I figure that the "no registered metadata for type ..." must be the original since it appears first and last. It runs fine unenhanced, so what can it be? Do enhanced entities only work with annotations? These entities are all mapped via xml.

Reply via email to