Getting an Exception org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId in EAP 6

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.2.0
  • Hibernate
    • 4.2.18

Issue

  • JBoss EAP stopped abnormally, We're getting the below error:
org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId:
17:51:04,792 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 18) MSC000001: Failed to start service jboss.persistenceunit."test.ear/test-web.war#Test": org.jboss.msc.service.StartException in service jboss.persistenceunit."test.ear/test-web.war#Test": org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId:
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
	at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.2.Final-redhat-1.jar:2.1.2.Final-redhat-1]
Caused by: org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId:
	at org.hibernate.cfg.CopyIdentifierComponentSecondPass.doSecondPass(CopyIdentifierComponentSecondPass.java:100)
	at org.hibernate.cfg.Configuration.processSecondPassesOfType(Configuration.java:1434)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1390)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1786)
	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
	... 4 more

17:51:04,798 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) JBAS014612: Operation ("deploy") failed - address: ([("deployment" => test.ear")]) - failure description: {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"test.ear/test.war#Test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.ear/test.war#Test\": org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId:

    Caused by: org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: "}}
17:51:04,800 ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "test.ear" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.persistenceunit.\"test.ear/test-web.war#Test\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"test.ear/test-web.war#Test\": org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId:

    Caused by: org.hibernate.AssertionFailure: Unexpected nested component on the referenced entity when mapping a @MapsId: "}}

Resolution

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.