Uploaded image for project: 'Hibernate ORM'
  1. HHH-12347

Unable to build Hibernate SessionFactory after upgrading to 5.2.14.Final

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects versions: 5.2.14
    • Fix versions: None
    • Components: hibernate-core
    • Environment:
      java-8-32bit, eclipse, tomcat-9
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Worked in:
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Updated from version 5.2.11 to 5.2.14

      Startup now yields the following error:

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: .....] Unable to build Hibernate SessionFactory
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:970)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:895)
      at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
      at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      ...
      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.metamodel.internal.MetamodelImpl.initialize(MetamodelImpl.java:128)
      at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:300)
      at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:460)
      at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)

      After several hours of searching, I somewhat found the error.

      If an EntityA has a member variable like

      Set<EntityB> attributes
      

      where EntityB inherits from some BaseEntity, the error is generated.
      As soon as I change the name "attributes" to something else, or
      remove the inheritance from EntityB, the issue seems to be fixed.

      A minimal example would look something like this:

      @Entity
      @Inheritance(strategy=InheritanceType.JOINED)	// or other
      public class BaseEntity {
      	@Id
      	private long id;
      }
      
      @Entity
      public class EntityA extends BaseEntity {
      	@OneToMany(fetch=FetchType.LAZY)
      	private Set<EntityB> attributes;			// attributes as name seems to yield the error
      }
      
      @Entity
      public class EntityB {
      	@Id
      	private long id;
      }
      

      However, while the minimal example did not trigger the error,
      All other combinations with various of my classes reproduced the error,
      when above conditions were met.
      So there seem to be some additional requirements to trigger the error, I could not yet determine.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: