Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Entity name must be unique in a persistence unit

This is a bug.

In the mean time remove the <mapping-file>META-INF/orm.xml</mapping-file> specification from your persistence.xml and please enter a bug.

Cheers,
Guy

----- Original Message ----- From: "Leon Derks" <leon.derks@xxxxxxxxxx>
To: "EclipseLink User Discussions" <eclipselink-users@xxxxxxxxxxx>
Sent: Tuesday, April 15, 2008 11:19 AM
Subject: [eclipselink-users] Entity name must be unique in a persistence unit


Hello again,

I added an id property in Every class.
When I configure the persistence.xml file with hibernate everything works fine.

But when I configure it for eclipselink I get an error (see below)

Below you see a part of my persistence.xml

Persistence xml configuration
       ......
       ......
       <!-- EclipseLink -->

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
       <mapping-file>META-INF/orm.xml</mapping-file>
       <properties>
<property name="eclipselink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/> <property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
           <property name="eclipselink.jdbc.user" value="pli"/>
           <property name="eclipselink.jdbc.password" value="pli"/>
<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.oracle.Oracle10Platform"/>
           <property name="eclipselink.logging.level" value="FINEST"/>
       </properties>
        <!-- Hibernate
       <provider>org.hibernate.ejb.HibernatePersistence</provider>
       <mapping-file>META-INF/orm.xml</mapping-file>
       <properties>
           <property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true"/> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/> <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
            <property name="hibernate.connection.username" value="pli"/>
            <property name="hibernate.connection.password" value="pli"/>
        </properties>
       -->
   ......
   ......


Internal Exception: Exception [EclipseLink-7237] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080409)): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity name must be unique in a persistence unit. Entity name [CatalogProduct] is used for the entity classes [*****.model.CatalogProduct] and [*****.model.CatalogProduct]. at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:121) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:87) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60) at com.philips.lighting.guidecontrol.model.ImportTest.<init>(ImportTest.java:13) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
   at junit.framework.TestSuite.createTest(TestSuite.java:131)
   at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
   at junit.framework.TestSuite.<init>(TestSuite.java:75)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Leon
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




Back to the top