This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?" Watch "MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?" New topic
Author

MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?

Muhammad Ramahy
Greenhorn

Joined: Jun 14, 2011
Posts: 11

I get this exception:

org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags

the cause as I think is that in my user bean I have the following code:


see that the messages list is eagerly loaded while the followers list is not lazy initialized.

in the dao I have this code:

to add a follower to the followers list
and
to save message in messages list
I don't know how to load 2 lists on same time and I can accept any work around if exists.
regards
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?