Hibernate Exception - Simultaneously Fetch Multiple Bags

Today I bumped into the following Hibernate exception:


javax.persistence.PersistenceException: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
........
What's the problem? Because I have multiple one-to-many mappings in my hibernate object, and all of them require EAGER loading.

Check out this link: http://jroller.com/page/eyallupu?entry=hibernate_exception_simultaneously_fetch_multiple, it shows you three ways to fix the issue.

No comments: