Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question



I have an object with two child collections. When I tried to make both FetchType.EAGER, Hibernate throws a MultiBagFetchException and what I have read is this is by design. So I changed this to be lazy which fixes the exception. Now when I do the initialLoad in my ExternalDataSource and try to use these collections, I get an error that says the session is closed and cannot do the lazy load. So how is this suppose to be done if I am using the DefaultHibernateExternalSource initialLoad() implementation so that it forces all Lazy associations to be touched prior to loading them in the space?

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3690]{quote}

asked 2011-06-21 12:27:58 -0500

rchristy gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

I'm not sure you can use GigaSpaces with LAZY mode. You must use EAGER mode.

btw - When fetching collections use the @Fetch(FetchMode.SELECT) annotation. This is a result of hibernate bug HHH-1751. The default @Fetch(FetchMode.JOIN) mode won't fetch all members.


answered 2011-06-21 14:50:02 -0500

shay hassidim gravatar image
edit flag offensive delete link more


I understand that, but Hibernate doesn't allow you to put two different collections in the same object and use FetchType.EAGER. So how do you propose we handle that situation? I tried the annotation you suggested and it still is Lazy fetching.

rchristy gravatar imagerchristy ( 2011-06-21 16:36:17 -0500 )edit

Hi Rich,

As far as i know there are two relevant solutions for this Hibernate problem:
1. Have an @IndexColumn annotation on the collections.


2. Replace your collections with java.util.Set.

idan gravatar imageidan ( 2011-06-23 07:22:28 -0500 )edit

Changing it to a Set worked perfectly, thanks for the help

rchristy gravatar imagerchristy ( 2011-06-23 08:25:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2011-06-21 12:27:58 -0500

Seen: 67 times

Last updated: Jun 21 '11