openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohit Kelapure <>
Subject Re: Running CacheTest: class does not appear in the list of persistent types
Date Mon, 12 Oct 2009 22:05:11 GMT

After some investigation I have resolved this issue.

These are my findings:

Yes It is necessary for all persistable entities to be defined in the
persistence.xml files when running standalone.

It is important for the testcase to load the EMFs from the correct
persistence.xml. The error below was due to loading an incorrect
persistence.xml  in the test case.

The relevant code is in

    protected String computePersistenceXmlResource(String s) {
        String resourceName = getClass().getPackage().getName()
            .replaceAll("\\.", "/");
        resourceName += "/common/apps/META-INF/persistence.xml";
        URL resource =
        if (resource != null){
            System.out.println("*** Loading persistence.xml "+
            return resourceName;
        } else {
            System.err.println("*** Could NOT find "+ resourceName+ " Now
returning default persistence resource ");
            return defaultPersistenceXmlResource();

I would really like for these log statements to get added to this testcase
for future guidance.

Rohit Kelapure

Rohit Kelapure wrote:
> I am trying to execute org.apache.openjpa.persistence.datacache.CacheTest
> with a custom cache provider. 
> In spite of having ALL entity classes on the classpath when executing the
> test, openJPA complains that 
> the entity was not found in the list of persistent types.
> <openjpa-2.0.0-SNAPSHOT-r422266:824213 fatal user error>
> org.apache.openjpa.persistence.ArgumentException: No metadata was found
> for type "class
> org.apache.openjpa.persistence.datacache.common.apps.CacheObjectA". The
> class does not appear in the list of persistent types:
> [org.apache.openjpa.persistence.common.apps.Student, ...........].
> When I decompiled CacheObjectA in
> C:\open-jpa\openjpa-trunk\openjpa-persistence-jdbc\target\test-classes\org\apache\openjpa\persistence\datacache\common\apps,
> I saw that CacheObjectA implements  PersistenceCapable which means that
> the enhancer did its job.
> The surefire plugin test classpath does contain the
> C:\open-jpa\openjpa-trunk\openjpa-persistence-jdbc\target\test-classes dir
> on its classpath
> What does one need to do to get OpenJPA to recognize a persistence capable
> class ?
> Is it necessary for all persistable entities to be defined in the orm xml
> files in addition to having the @Entity annotation ?
> --Thanks,
> Rohit Kelapure

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message