[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5241) One-to-many relationship to class with JOINED inheritance causes assertion failure in JoinedSubclassEntityPersister

Stu White (JIRA) noreply at atlassian.com
Thu May 20 06:27:11 EDT 2010


One-to-many relationship to class with JOINED inheritance causes assertion failure in JoinedSubclassEntityPersister
-------------------------------------------------------------------------------------------------------------------

                 Key: HHH-5241
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5241
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.5.0-CR-1
         Environment: Hibernate 3.5.0-CR1 (included with JBoss Application Server 6.0.0 M2)
SQL Server 2005
            Reporter: Stu White
         Attachments: testcase.zip

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. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list