-->
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.  [ 3 posts ] 
Author Message
 Post subject: org.hibernate.loader.MultipleBagFetchException: cannot simul
PostPosted: Tue Jan 19, 2010 11:11 am 
Newbie

Joined: Wed Oct 14, 2009 3:22 pm
Posts: 16
Hi,

I'm using Hibernate 3.3.2.ga, tools 3.2.0, and annotations 3.4.0.GA on a Resin 3.0.19 app server (Java 1.5). I am dying with the exception, "org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags" when trying to initialize a session. A thread that is six years old implies I should change some other models to do LAZY instead of EAGER fetching but I'm not sure how that applies here since I'm not fetching anything yet.

Here's the call I'm making ...

Code:
Session session = sessionFactory.openSession()


And here's the error. Any advice? - Dave

Code:
ERROR [myco.dor.online.interlock.service.ejb.ReportsServiceBean, main 2010-01-19 08:02:08,373]:
=>ReportsServiceBean.getFinancialAssistanceReport() : Failed to generate trading partner report
org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags
   at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:94)
   at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:98)
   at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:66)
   at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:56)
   at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:126)
   at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1765)
   at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1769)
   at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:3002)
   at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:2995)
   at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:712)
   at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:329)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
   at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
   at myco.dor.online.interlock.service.ejb.HibernateFactory.initSessionFactory(HibernateFactory.java:33)
   at myco.dor.online.interlock.service.ejb.HibernateFactory.getSessionFactory(HibernateFactory.java:23)
   at myco.dor.online.interlock.service.reports.utils.DBUtils.<init>(DBUtils.java:45)
   at myco.dor.online.interlock.service.reports.utils.DBUtils.getInstance(DBUtils.java:49)
   at myco.dor.online.interlock.service.reports.FinancialAssistanceReport.getReportData(FinancialAssistanceReport.java:24)
   at myco.dor.online.interlock.service.reports.AbstractReport.generateHTMLReportToStream(AbstractReport.java:192)
   at myco.dor.online.interlock.service.ejb.ReportsServiceBean.getFinancialAssistanceReport(ReportsServiceBean.java:69)
   at myco.dor.online.interlock.service.ejb.ReportsServiceBean$$FastClassByCGLIB$$4d0b53c6.invoke(<generated>)
   at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
   at org.mockejb.interceptor.InterceptorInvoker$CglibMethodInvoker.intercept(InterceptorInvoker.java:95)
   at org.mockejb.interceptor.InvocationContext.proceed(InvocationContext.java:177)
   at org.mockejb.interceptor.InterceptorInvoker.invoke(InterceptorInvoker.java:53)
   at org.mockejb.MockEjbObject.invoke(MockEjbObject.java:147)
   at $Proxy2.getFinancialAssistanceReport(Unknown Source)
   at myco.dor.online.interlock.test.ejb.ReportsTest.testFinancialAssistanceReport(ReportsTest.java:27)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at junit.framework.TestCase.runTest(TestCase.java:164)
   at junit.framework.TestCase.runBare(TestCase.java:130)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:120)
   at junit.framework.TestSuite.runTest(TestSuite.java:230)
   at junit.framework.TestSuite.run(TestSuite.java:225)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:297)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:1072)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:682)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1434)
   at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:632)
   at org.apache.tools.ant.Task.perform(Task.java:364)
   at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
   at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
   at org.apache.commons.jelly.tags.core.OtherwiseTag.doTag(OtherwiseTag.java:41)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
   at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
   at org.apache.commons.jelly.tags.core.ChooseTag.doTag(ChooseTag.java:38)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
   at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
   at org.apache.commons.jelly.tags.core.IfTag.doTag(IfTag.java:42)
   at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
   at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:83)
   at org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:116)
   at org.apache.maven.werkz.Goal.fire(Goal.java:691)
   at org.apache.maven.werkz.Goal.attain(Goal.java:623)
   at org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:712)
   at org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)
   at org.apache.maven.cli.App.doMain(App.java:307)
   at org.apache.maven.cli.App.main(App.java:217)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at com.werken.forehead.Forehead.run(Forehead.java:551)
   at com.werken.forehead.Forehead.main(Forehead.java:581)


Top
 Profile  
 
 Post subject: Re: org.hibernate.loader.MultipleBagFetchException: cannot simul
PostPosted: Tue Jan 19, 2010 9:55 pm 
Expert
Expert

Joined: Tue May 13, 2008 3:42 pm
Posts: 919
Location: Toronto & Ajax Ontario www.hibernatemadeeasy.com
This happens when you've got multiple associations with an eagar load. I think it's multiple classes eagarly loading another, or something like that. Change some associations to lazy, and see what happens.

_________________
Cameron McKenzie - Author of "Hibernate Made Easy" and "What is WebSphere?"
http://www.TheBookOnHibernate.com Check out my 'easy to follow' Hibernate & JPA Tutorials


Top
 Profile  
 
 Post subject: Re: org.hibernate.loader.MultipleBagFetchException: cannot simul
PostPosted: Thu Feb 10, 2011 4:47 pm 
Newbie

Joined: Fri Feb 04, 2011 9:49 pm
Posts: 11
I've got the same problem. I can't change from Lists because I'm not the one defining the objects. And I can't switch to LAZY because this is an RPC-type application where we always need to fetch right away. Frustrated....


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

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.