org.hibernate.AssertionFailure

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I've created a JPA mapping for a class that has a one-to-many relationship via a join table to other classes which are using a JOINED inheritance strategy, and I'm getting an odd error which makes me wonder whether I've come across a bug in Hibernate. The particular error I'm getting is: Exception in thread "main" 2010-05-20 10:00:04,783 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: Table JpaTest.ParentOwnerJoinTable not found at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:497) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:276) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:272) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:974) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:850) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at com.i2group.jpatest.JpaTestBase.createEntityManager(JpaTestBase.java:51) at com.i2group.jpatest.JpaOwnershipInheritanceTest.writeEntity(JpaOwnershipInheritanceTest.java:28) at com.i2group.jpatest.JpaOwnershipInheritanceTest.main(JpaOwnershipInheritanceTest.java:22) I've attached a zip containing the classes, persistence XML, and SQL Server setup script. The classes are: Owner The owner linked by a one-to-many relationship to Parent/ChildOne/ChildTwo Parent Parent class using a JOINED inheritance strategy ChildOne Child of Parent ChildTwo Child of Parent The error only seems to occur when combining a one-to-many relationship via a join table to a class using inheritance. If I remove the link to Owner and just test the inheritance of Parent/ChildOne/ChildTwo then it works fine. If I remove the inheritance and just test the one-to-many relationship from Owner to Parent then it works fine. If I try to combine the two then I get the error above. I don't think I'm doing anything particularly obscure, which makes me suspicious that this is more likely to be a mistake in my configuration than a bug in Hibernate. However, I've checked the configuration and tested parts of it separately and have been unable to find what (if anything) I'm doing wrong. If there's any further information I can provide to help diagnose this then please let me know.
    via by Stu White,
  • I've created a JPA mapping for a class that has a one-to-many relationship via a join table to other classes which are using a JOINED inheritance strategy, and I'm getting an odd error which makes me wonder whether I've come across a bug in Hibernate. The particular error I'm getting is: Exception in thread "main" 2010-05-20 10:00:04,783 - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: Table JpaTest.ParentOwnerJoinTable not found at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:497) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:276) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:272) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:974) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:850) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at com.i2group.jpatest.JpaTestBase.createEntityManager(JpaTestBase.java:51) at com.i2group.jpatest.JpaOwnershipInheritanceTest.writeEntity(JpaOwnershipInheritanceTest.java:28) at com.i2group.jpatest.JpaOwnershipInheritanceTest.main(JpaOwnershipInheritanceTest.java:22) I've attached a zip containing the classes, persistence XML, and SQL Server setup script. The classes are: Owner The owner linked by a one-to-many relationship to Parent/ChildOne/ChildTwo Parent Parent class using a JOINED inheritance strategy ChildOne Child of Parent ChildTwo Child of Parent The error only seems to occur when combining a one-to-many relationship via a join table to a class using inheritance. If I remove the link to Owner and just test the inheritance of Parent/ChildOne/ChildTwo then it works fine. If I remove the inheritance and just test the one-to-many relationship from Owner to Parent then it works fine. If I try to combine the two then I get the error above. I don't think I'm doing anything particularly obscure, which makes me suspicious that this is more likely to be a mistake in my configuration than a bug in Hibernate. However, I've checked the configuration and tested parts of it separately and have been unable to find what (if anything) I'm doing wrong. If there's any further information I can provide to help diagnose this then please let me know.
    via by Stu White,
  • I am trying to create bidirectional association between two entities in which one can be Inherited and it fails with table not found: 11:37:39,229 ERROR [AssertionFailure] [] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: Table CRM.CRM_AKTIVNOST_DOGODKI not found at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:480) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:259) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) The code looks like this: @Entity @Table(name = "CRM_AKTIVNOST") public class Aktivnost implements Serializable { private List<Dogodek> dogodki; .... .... @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy = "aktivnost") public List<Dogodek> getDogodki() { return dogodki; } public void setDogodki(List<Dogodek> dogodki) { this.dogodki = dogodki; } ... ... } @Entity @Table(name = "CRM_DOGODEK") @Inheritance(strategy= InheritanceType.JOINED) public class Dogodek implements Serializable { ... ... private Aktivnost aktivnost; .... .... @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "CRM_AKTIVNOST_DOGODKI", joinColumns = {@JoinColumn(name = "DOGODEK_ID")}, inverseJoinColumns = {@JoinColumn(name = "AKTIVNOST_ID")}) public Aktivnost getAktivnost() { return aktivnost; } public void setAktivnost(Aktivnost aktivnost) { this.aktivnost = aktivnost; } ... }
    via by Tomaz Cerar,
  • I am trying to create bidirectional association between two entities in which one can be Inherited and it fails with table not found: 11:37:39,229 ERROR [AssertionFailure] [] an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: Table CRM.CRM_AKTIVNOST_DOGODKI not found at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:480) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:259) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:261) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246) The code looks like this: @Entity @Table(name = "CRM_AKTIVNOST") public class Aktivnost implements Serializable { private List<Dogodek> dogodki; .... .... @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,mappedBy = "aktivnost") public List<Dogodek> getDogodki() { return dogodki; } public void setDogodki(List<Dogodek> dogodki) { this.dogodki = dogodki; } ... ... } @Entity @Table(name = "CRM_DOGODEK") @Inheritance(strategy= InheritanceType.JOINED) public class Dogodek implements Serializable { ... ... private Aktivnost aktivnost; .... .... @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "CRM_AKTIVNOST_DOGODKI", joinColumns = {@JoinColumn(name = "DOGODEK_ID")}, inverseJoinColumns = {@JoinColumn(name = "AKTIVNOST_ID")}) public Aktivnost getAktivnost() { return aktivnost; } public void setAktivnost(Aktivnost aktivnost) { this.aktivnost = aktivnost; } ... }
    via by Tomaz Cerar,
  • I have encountered the issue for creating a many to one relation ship. could you please check below error . This is same bug like ANN-376 http://opensource.atlassian.com/projects/hibernate/browse/ANN-376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel In this error the status is duplicate, but no one mention where it was solved. fe use of the session) [java] org.hibernate.AssertionFailure: Table XXXXXXXXXXX not found [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:458) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:237) [java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58) [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226) [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) [java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713) [java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121) [java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:458) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:237) [java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58) [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226) [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) [java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713) [java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121) [java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) [java] at co It is creating a table. There was no problem with creating a table or connection
    via by SATISH K R YERUVA,
  • I have encountered the issue for creating a many to one relation ship. could you please check below error . This is same bug like ANN-376 http://opensource.atlassian.com/projects/hibernate/browse/ANN-376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel In this error the status is duplicate, but no one mention where it was solved. fe use of the session) [java] org.hibernate.AssertionFailure: Table XXXXXXXXXXX not found [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:458) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:237) [java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58) [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226) [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) [java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713) [java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121) [java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:458) [java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:237) [java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58) [java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226) [java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294) [java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:713) [java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121) [java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) [java] at co It is creating a table. There was no problem with creating a table or connection
    via by SATISH K R YERUVA,
  • I have created a JPA orm mapping file for an entity hierarchy using the JOINED inheritance strategy. In the mapping file, I specify the default schema like this: {{ <entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd" version="2.1"> <schema>fim</schema> ...... }} Everything works fine until I migrate to Hibernate higher than 5.0.1, up to 5.0.7 which is bundled in Wildfly 10 at the moment. When deploy the application to Wildfly 10, I got the following error: {quote} 13:58:04,770 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 164) MSC000001: Failed to start service jboss.persistenceunit."fim-manager-webapp-1.0-SNAPSHOT.war#FimPu-jta-mysql": org.jboss.msc.service.StartException in service jboss.persistenceunit."fim-manager-webapp-1.0-SNAPSHOT.war#FimPu-jta-mysql": javax.persistence.PersistenceException: [PersistenceUnit: FimPu-jta-mysql] Unable to build Hibernate SessionFactory 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: javax.persistence.PersistenceException: [PersistenceUnit: FimPu-jta-mysql] Unable to build Hibernate SessionFactory at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:954) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:882) 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 Caused by: org.hibernate.MappingException: Could not instantiate persister org.hibernate.persister.entity.JoinedSubclassEntityPersister at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:112) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:346) at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ... 9 more Caused by: org.hibernate.AssertionFailure: Table fim.ASC_FEED_ENTRY not found at org.hibernate.persister.entity.AbstractEntityPersister.getTableId(AbstractEntityPersister.java:5107) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:433) at sun.reflect.GeneratedConstructorAccessor89.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) ... 13 more {quote} The workaround is removing <schema> elements for these entities in the inheritance hierarchy from the mapping file. For other entities, they work fine with or without <schema>.
    via by Roger Suen,
    • org.hibernate.AssertionFailure: Table JpaTest.ParentOwnerJoinTable not found at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:497) at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:276) at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:87) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:272) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:974) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:850) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at com.i2group.jpatest.JpaTestBase.createEntityManager(JpaTestBase.java:51) at com.i2group.jpatest.JpaOwnershipInheritanceTest.writeEntity(JpaOwnershipInheritanceTest.java:28) at com.i2group.jpatest.JpaOwnershipInheritanceTest.main(JpaOwnershipInheritanceTest.java:22)

    Users with the same issue

    Unknown visitor1 times, last one,