• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Hibernate: Why is bag semantic getting applied when I'm not using Lists?

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Using Hibernate 3.3.2.ga.

I have a model with two OneToMany relationships. Whenever I try and load my session, I'm getting the "org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags" exception. From what I've read, this should not happen if I'm using Sets, which I am. My model code is below. Any help is appreciated, - Dave


 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had this problem. I believe it happens when both sides of a one to many are marked eager. Either that, or multiple classes pointing to a certain other class have multiple many associations marked as eagar. I bet if you made eagar associations lazy, the problem would go away. Any thoughts?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, Cameron. I changed both associations in the included code from EAGER to LAZY but sadly this didn't heal the pain. Any other suggestions are appreciated, - Dave
 
Cameron Wallace McKenzie
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure.

Here's a good article on the topic:
Multiple Bag Fetch Exception In Hibernate

That's pretty much what I know and have experienced with this problem.
    Bookmark Topic Watch Topic
  • New Topic