Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

problem in loading entity metadata when giving class name in class tag of persistence.xml #132

Closed
kkmishra opened this Issue · 1 comment

3 participants

kkmishra Amresh Vivek Mishra
kkmishra

My persistenceUnit is

<persistence-unit name="secIdxCassandraTest">
        <provider>com.impetus.kundera.KunderaPersistence</provider>
        <class>com.impetus.client.crud.PersonCassandra</class>
        <properties>
            <property name="kundera.nodes" value="localhost" />
            <property name="kundera.port" value="9160" />
            <property name="kundera.keyspace" value="KunderaExamples" />
            <property name="kundera.dialect" value="cassandra" />
            <property name="kundera.ddl.auto.prepare" value="create"/>
            <property name="kundera.client.lookup.class"
                value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
            <property name="kundera.cache.provider.class"
                value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
            <property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
        </properties>
    </persistence-unit>

stack trace

com.impetus.kundera.loader.MetamodelLoaderException: Name conflict between classes com.impetus.client.crud.PersonCassandra and com.impetus.client.crud.PersonCassandra. Make sure no two entity classes with the same name are specified for persistence unit secIdxCassandraTest
at com.impetus.kundera.configure.MetamodelConfiguration.scanClassAndPutMetadata(MetamodelConfiguration.java:309)
at com.impetus.kundera.configure.MetamodelConfiguration.loadEntityMetadata(MetamodelConfiguration.java:208)
at com.impetus.kundera.configure.MetamodelConfiguration.configure(MetamodelConfiguration.java:97)
at com.impetus.kundera.configure.Configurator.configure(Configurator.java:64)
at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:103)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:81)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at com.impetus.client.crud.PersonCassandraTest.setUp(PersonCassandraTest.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Vivek Mishra mevivs was assigned
Amresh xamry was assigned
Amresh

Tested. This problem only occurs when two entity classes with the same name but different packages exist in classpath. Kundera throws exception with helpful error message in this case in order to guide user for taking corrective action.

This scenario is not allowed since JPA queries contain entity name (not fully qualified) and it would be impossible for Kundera to know intended entity class from the JPA query.

Amresh xamry closed this
Amresh xamry was unassigned by kkmishra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.