I'm working on an application server bug fix that I need some advice
with, as Hibernate ORM 4.3.6.Final is throwing a
"o.h.DuplicateMappingException: Duplicate query mapping
EventManager.MyEvents" after I fixed a jar-file reference bug in WildFly
(when I try to deploy a test case).
Prior to my jar-file bug fix, the jar-file URL was incorrectly pointing
at the wrong location (zero files were returned when file url was
accessed). As a result, entities were loaded only once from the ear/lib
jar. Now, with my bug fix (getJarFileUrls now returns a valid URL for
jar-file) , WildFly is getting the DuplicateMappingException because the
entity is loaded twice (even though *exclude-unlisted-classes* is in the
persistence unit).
I would like to resolve the DME before back porting the "jar-file"
(WildFly) bug fix. I didn't see this behaviour in my ORM 4.2.x testing
(with EAP).
By the way, the getPersistenceUnitRootUrl is the test.ear.
test.ear contents:
lib
test-entities.jar
META-INF
application.xml
MANIFEST.MF
persistence.xml
test-ejb.jar
persistence.xml contents:
<persistence-unit name="jboss-eap-hibernate"
transaction-type="JTA">
<jar-file>lib/test-entities.jar</jar-file>
<exclude-unlisted-classes/>
</persistence-unit>
test-entities.jar contents:
META-INF
Event.hbm.xml
EventManager entity class
Event entity class
Event.hbm.xml contents:
<hibernate-mapping package="support.jboss.ejb.entity">
<sql-query name="EventManager.MyEvents">
<load-collection alias="manages" role="EventManager.manages"
/>
SELECT * FROM EVENT e where e.manager = ?
</sql-query>
Thanks,
Scott
Show replies by date