Hello everybody, I use Hibernate 2 and I'd have the following question:
In a class mapping I declare a bag-collection which is not indicated to be a lazy one (so, this is a parent object). This collection contains objects of a class, who has a "proxy" attribute in its mapping (and these are child-objects). The colection may also be empty.
When I get a parent object with an HQL query (in which I write nothing about that collection), I get a LazyInitializationException when I try to access the collection's elements later (that is right and it is clear, why it happens - a "proxy" attribute). So, I should specify in my query that all elements of the collection are to initialize when I am fetching the parent object. How can I do it? Should a "LEFT JOIN FETCH" construction work? Seems like JOIN FETCH does not work...
|