shnplr wrote:
Q. does the above code initialize as per lazy="false"?
Er, yes.
shnplr wrote:
Q. does hibernate have a utility which does this?
if not can anyone suggest a dynamic solution...should I be writing my own utility method which reads the mapping and dynamically initializes using java reflection api...or something?
You can access the mapping via sessionFactory.getClassMetadata(YourClass.class) (see also getCollectionMetadata() method). So if you're mapping say Foo.java which owns your numerous collections, retrieve the classMetadata of this class after having loaded the instance of YourClass you want. Then call Hibernate.initialize() by reflection on each collection. I did it recently, it works ok.
You should maybe map your collections using fetch="subselect" so as there's only one select, even if you have many YourClass instances.