File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets 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
 
 
subject: MultipleBagFetchException: cannot simultaneously fetch multiple bags. How to load 2 lists?
 
Similar Threads
Many to many self join using hibernate annotation
Duplicate Row IN Hibernate Fetch
Toplink refresh ManyToMany
Confused with many to many,
How do I get a UserDetails object from a Principal object?