views:

42

answers:

1

I am using JPA (OpenJPA). I have following entries in my persistence.xml:

<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>

I also have Serviceoffering class listed in perisitence.xml. I am getting following exception when I try to run my jpa related code. What can be the problem?

No metadata was found for type "class com.XYZ.cloud.bss.client.db.data.Serviceoffering".  Ensure that the class is enhanced (if necessary), that the class has appropriate metadata, and that if you list your persistent classes, the class is included in your list.
C = null
<openjpa-1.2.1-SNAPSHOT-r422266:686069 fatal user error> org.apache.openjpa.persistence.ArgumentException: No metadata was found for type "class com.XYZ.cloud.bss.client.db.data.Serviceoffering".  Ensure that the class is enhanced (if necessary), that the class has appropriate metadata, and that if you list your persistent classes, the class is included in your list.
    at org.apache.openjpa.meta.MetaDataRepository.getImplementorMetaDatas(MetaDataRepository.java:1108)
    at org.apache.openjpa.kernel.QueryImpl.createExecutor(QueryImpl.java:720)
    at org.apache.openjpa.kernel.QueryImpl.compileForDataStore(QueryImpl.java:692)
    at org.apache.openjpa.kernel.QueryImpl.compileForExecutor(QueryImpl.java:674)
    at org.apache.openjpa.kernel.QueryImpl.getOperation(QueryImpl.java:1492)
    at org.apache.openjpa.kernel.DelegatingQuery.getOperation(DelegatingQuery.java:123)
    at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:243)
    at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:293)
    at c
A: 

Add <class>com.XYZ.cloud.bss.client.db.data.Serviceoffering</class> to your persistence.xml file and make sure that the class Serviceoffering is loaded by the JVM prior to executing your query.

Now I'm going to highly recommend that you don't set <property name="openjpa.RuntimeUnenhancedClasses" value="supported"/>. Yes some support is there, but it's going to give you a lot of headaches. Take a peek through a blog post I wrote a long time back talking about the enhancement process.... that should get you rolling.

Rick