Hello everyone,
I'm new to Hibernate, this is my first real experience with this ORM. I'm working on migration of our software from other JPA implementation to Hibernate. I manage to change our model for various aspects that differs from our current implementation. However I'm stuck with:
Code:
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: xxxxxxxxx] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:268)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 35 more
[b]Caused by: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags[/b]
at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:93)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:118)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:70)
at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:53)
at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:131)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2435)
at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:2458)
at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3736)
at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:3722)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:457)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1750)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905)
... 41 more
This is thrown when starting application and initializing EntityManagerFactory.
I did try to set logging to trace, but even then I can't figure out which entity has wrong mapping. I can find many examples how to solve this problem, but non of them shows how to debug this. I did change all fetch strategies to LAZY. But there is still a problem.
So, is there any way to check on which entity class annotation processing is interrupted and this exception is thrown?
I'm using Hibernate 4.1.7 with Spring 3.1.2, SLF4j, Postgresql 9.1 with JDBC driver 9.1-901.jdbc4, BoneCP as connection pooling 0.7.1Rel, log back and Tomcat 7.0.30. Everything works on Java 7 (1.7.0_07).
Thanks for help