Hi Petar,
You can use this template:
http://in.relation.to/2016/01/14/hibernate-jpa-test-case-template/
to create a test case that replicates the issue. You don't need to provide
all entities,
just the 4 entities that build that hierarchy you have mentioned in your
email.
If you can replicate it, please open a Jira issue and attach the test case
so that it's easier
to investigate the cause and provide a fix.
Thanks,
Vlad
On Thu, Mar 1, 2018 at 10:41 AM, Petar Tahchiev <paranoiabla(a)gmail.com>
wrote:
Hi Christian,
My model has more than 250 entities big. Here's the code that throws the
NLP:
Class<?> c1 = clazz1.getMappedClass();
Class<?> c2 = commonPersistentClass.getMappedClass();
MappedSuperclass commonMappedSuperclass = null;
// First we traverse up the clazz2/commonPersistentClass super types
until we find a common type
while ( !c2.isAssignableFrom( c1 ) ) {
if ( commonPersistentClass == null) {
if ( commonMappedSuperclass.getSuperPersistentClass() == null )
{ // <------------------------ NLPEX happens here!!!!!!
commonMappedSuperclass =
commonMappedSuperclass.getSuperMappedSuperclass();
commonPersistentClass = null;
}
else {
commonPersistentClass =
commonMappedSuperclass.getSuperPersistentClass();
commonMappedSuperclass = null;
}
}
else {
if ( commonPersistentClass.getSuperclass() == null ) {
commonMappedSuperclass =
commonPersistentClass.getSuperMappedSuperclass();
commonPersistentClass = null;
}
else {
commonPersistentClass = commonPersistentClass.getSuperclass();
commonMappedSuperclass = null;
}
}
}
As you can see the commonMappedSuperclass is not initialized and stays
null!
At this moment c1 is CustomerEntity and c2 is UserGroupEntity. The
hierarchy looks like this:
Principal
/ \
Usergroup User
|
Customer
HTH
2018-02-28 21:52 GMT+02:00 Christian Beikov <christian.beikov(a)gmail.com>:
> Hey, I saw the comment on the issue. Thanks for reporting. Could you
> maybe post the model that causes this? I'd need to create a reproducer
> to be able to analyze this further.
>
>
> Mit freundlichen Grüßen,
> ------------------------------------------------------------------------
> *Christian Beikov*
> Am 28.02.2018 um 20:11 schrieb Petar Tahchiev:
> > Hi guys,
> > I have this exception with latest 5.2.14 (my project runs fine with
> 5.2.13):
> >
> > Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
> > default] Unable to build Hibernate SessionFactory
> > at
> > org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImp
> l.persistenceException(EntityManagerFactoryBuilderImpl.java:970)
> > at
> > org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(
> EntityManagerFactoryBuilderImpl.java:895)
> > at
> > org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceP
> rovider.createContainerEntityManagerFactory(
SpringHibernateJpaPersistenceP
> rovider.java:57)
> > at
> > org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.
> createNativeEntityManagerFactory(LocalContainerEntityManagerFac
> toryBean.java:365)
> > at
> > org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.
> buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBe
an.java:387)
> > at
> > org.springframework.orm.jpa.AbstractEntityManagerFactoryBe
> an.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:376)
> > at
> > org.springframework.orm.jpa.LocalContainerEntityManagerFac
> toryBean.afterPropertiesSet(LocalContainerEntityManagerFac
> toryBean.java:341)
> > at
> > org.springframework.beans.factory.support.
AbstractAutowireCapableBeanFac
> tory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769)
> > at
> > org.springframework.beans.factory.support.
AbstractAutowireCapableBeanFac
> tory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706)
> > ... 32 more
> > Caused by: org.hibernate.MappingException: Could not instantiate
> persister
> > org.hibernate.persister.entity.SingleTableEntityPersister
> > 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)
> > ... 39 more
> > Caused by: java.lang.NullPointerException
> > at
> > org.hibernate.persister.entity.AbstractPropertyMapping.
> getSuperCollection(AbstractPropertyMapping.java:285)
> > at
> > org.hibernate.persister.entity.AbstractPropertyMapping.
addPropertyPath(
> AbstractPropertyMapping.java:198)
> > at
> > org.hibernate.persister.entity.AbstractPropertyMapping.
> initPropertyPaths(AbstractPropertyMapping.java:395)
> > at
> > org.hibernate.persister.entity.AbstractEntityPersister.
> initOrdinaryPropertyPaths(AbstractEntityPersister.java:2300)
> > at
> > org.hibernate.persister.entity.AbstractEntityPersister.
> initPropertyPaths(AbstractEntityPersister.java:2347)
> > at
> > org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(
> AbstractEntityPersister.java:3906)
> > at
> > org.hibernate.persister.entity.SingleTableEntityPersister.<init>(
> SingleTableEntityPersister.java:437)
> > at sun.reflect.GeneratedConstructorAccessor94.newInstance(Unknown
> > Source)
> > at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
> > at java.lang.reflect.Constructor.newInstance(Constructor.java:
423)
> > at
> > org.hibernate.persister.internal.PersisterFactoryImpl.
> createEntityPersister(PersisterFactoryImpl.java:96)
> > ... 44 more
> >
> >
> >
> >
> >
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
--
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF 55A5 1965 8550 C311 0611
_______________________________________________
hibernate-dev mailing list
hibernate-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev