-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to debug "cannot simultaneously fetch multiple bags"?
PostPosted: Wed Oct 24, 2012 7:56 am 
Newbie

Joined: Wed Oct 24, 2012 7:37 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.