Getting org.hibernate.DuplicateMappingException: Duplicate entity mapping in EAP 7.0.0 Beta

Solution Verified - Updated -

Issue

  • We are upgrading from EAP 5 to EAP 7 (via EAP 6). It worked in EAP 6 but is not working in EAP 7. It seems like a Hibernate 5 issue. We are not sure what is causing hibernate to read the mapping files twice. The duplicate mapping is not specific to a particular class, it can happen to any class.

  • We are is getting the below error:

2016-01-08 11:17:42,648 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 75) MSC000001: Failed to start service jboss.persistenceunit : org.jboss.msc.service.StartException in service jboss.persistenceunit."Test": org.hibernate.DuplicateMappingException: Duplicate entity mapping
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117)
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: org.hibernate.DuplicateMappingException: Duplicate entity mapping
    at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.addEntityBinding(InFlightMetadataCollectorImpl.java:271)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindDiscriminatorSubclassEntities(ModelBinder.java:512)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindDiscriminatorSubclassEntity(ModelBinder.java:560)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindDiscriminatorSubclassEntities(ModelBinder.java:510)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindDiscriminatorSubclassEntity(ModelBinder.java:560)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindDiscriminatorSubclassEntities(ModelBinder.java:510)
    at org.hibernate.boot.model.source.internal.hbm.ModelBinder.bindEntityHierarchy(ModelBinder.java:197)
    at org.hibernate.boot.model.source.internal.hbm.HbmMetadataSourceProcessorImpl.processEntityHierarchies(HbmMetadataSourceProcessorImpl.java:144)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:218)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:770)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:797)
    at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154)
    ... 7 more

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.0.0 Beta
  • Hibernate
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content