I have isolated the problem a little: the Grid is a red herring, the problem lies with the hierarchy of objects. The following HQL exhibits the same problem:
from com.madeye.darkcity.model.object.MonsterObject
However, the Grid is supposed to be a lightweight object - the object it points to should not be loaded with the Grid. So, the original query should have worked (i.e. not loaded any objects). Does CascadeType.ALL force the loading of objects in a similar way to FetchType.EAGER?
The single query above generated about 270k of SQL. I know that this Grid structure will fit in memory as when the objects are first created it all works fine. It's only when the state is restored from the database. I have put the output here:
http://www.madeye.com/obj_test.html
as it's too large to post. If anyone can take a look and point out any obvious mistakes I'd be most grateful.
Thanks,
Matt