We're updating the issue view to help you get more done. 

Unable to build Hibernate SessionFactory after upgrading to 5.2.14.Final

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

1 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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 @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.

Environment

java-8-32bit, eclipse, tomcat-9

Status

Assignee

Christian Beikov

Reporter

hirokazu

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.2.11

Components

Affects versions

5.2.14

Priority

Major