I am working with a very large object graph and thus all of my relationships are lazily loaded. This works quite well, except when dealing with collections. It seems that while Hibernate maps lazily loaded collections with a PersistentBag (I'm using annotations and explicitly marking all relationships as FetchType.LAZY). This is what I expect. However, I'm getting errors when accessing the bag (specifically, too many joins when MySQL is my back-end DB) because accessing any method of the bag (size(), get(int x), etc...) forces a deep initialization (as seen by the stack trace) of the underlying collection. Is there no way to access one of the members of the bag (which I would assume to be a proxy anyway) without causing a deep initialization?
|