kshreeram wrote:
Yeah, I know that Criteria's setFetchMode can be used to dynamically change the lazy loading, but with this approach I have to list out all associations within my query and for each of this association I would have to mark the fetch mode. ( I have one primary table and n dependant tables )
If there is another generic alternative where I can just programmatically iterate over all the relations of a particular table ( or say the mappings ) and change the fetch mode, it would be better. Or at a high level if I could say do a full loading of whatever is possible for this criteria - rather than at an individual relationship level...
Please let me know if my question is not clear.
Thanks
This wiki topic doesn't do what your asking but it might address your need.
http://www.hibernate.org/41.html
You can have a base object without the associated tables and another mapping with all the associations eagerly loaded.