my dog learned polymorphism*
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?