8

When starting up my app I see for every class this warning:

WARN  [DataNucleus.MetaData] - Class com.mycomp.MyClass was specified in persistence-unit myPersistenceUnit but not annotated, so ignoring

The app starts up correctly so there is no direct issue, but I'm wondering where this coming form, and how to avoid id.

My persistence.xml looks like:

<persistence-unit name="myPersistenceUnit">
    <provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
    <properties>
        <property name="datanucleus.ConnectionURL" value="appengine" />
        <property name="datanucleus.NontransactionalRead" value="true" />
        <property name="datanucleus.NontransactionalWrite" value="true" />
        <property name="datanucleus.appengine.datastoreEnableXGTransactions" value="true" />
        <property name="datanucleus.jpa.addClassTransformer" value="false" />
    </properties>
</persistence-unit>

I'm running my app on Google App Engine with Spring.

But I can't find the origin of the warnings. Something seems to be telling my app to do some check for all classes.

PS: I'm defining my entityManagerFactory as follows:

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setPersistenceUnitName("myPersistenceUnit");
    entityManagerFactory.setPersistenceUnitPostProcessors(new ClasspathScanningPersistenceUnitPostProcessor("com.mycomp.domain"));
    return entityManagerFactory;
}

Any help appreciated.

Marcel Overdijk
  • 11,041
  • 17
  • 71
  • 110

1 Answers1

6

You aren't including any < jar-file > or < class > tags in your persistence.xml, so my guess is that your application is searching for Entities in all the classes it can reach. Maybe you are mixing Entity with non-Entity classes in the same java package. You don't say much about the pacakges or your classes really.

E. Celis
  • 717
  • 7
  • 17
  • indeed, and user doesn't put "exclude-unlisted-classes" anywhere there so accepts it to go off and scan his CLASSPATH. – DataNucleus Apr 08 '13 at 15:39
  • 3
    I added true to persistence.xml and that caused the warning to go away. The entity classes are scanned in the creation of Spring's LocalContainerEntityManagerFactoryBean as shown in the question. Thanks for helping! – Marcel Overdijk Apr 08 '13 at 19:18