Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The enhancer seems to need to have all classes explicitly listed in the persistence.xml file. I would expect the enhancer to enhance any class that has mapping metadata or if exclude-unlisted is false any class with @Entity annotation. Anyway, I listed my classes in the persistence unit, but then I get the following exception:
java.lang.IllegalArgumentException: An attempt to override entity 'Employee
at org.apache.cayenne.map.DataMap.addObjEntity(DataMap.java:622)
at org.apache.cayenne.jpa.bridge.DataMapConverter$JpaEntityVisitor.createObject(DataMapConverter.java:505)
at org.apache.cayenne.jpa.bridge.DataMapConverter$NestedVisitor.onStartNode(DataMapConverter.java:690)
at org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:92)
at org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:113)
at org.apache.cayenne.util.TraversalUtil.traverse(TraversalUtil.java:80)
at org.apache.cayenne.jpa.bridge.DataMapConverter.toDataMap(DataMapConverter.java:93)
at org.apache.cayenne.jpa.Provider.createContainerEntityManagerFactory(Provider.java:250)
at org.apache.openejb.core.cmp.jpa.JpaTest.createEntityManagerFactory(JpaTest.java:201)
at org.apache.openejb.core.cmp.jpa.JpaTest.testJta(JpaTest.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at com.intellij.rt.execution.junit2.JUnitStarter.main(JUnitStarter.java:32)
You can reproduce this with the openejb JpaTest; just change the provider at the top of the test to cayenne.