Hy.
Is it somehow possible to fully initialize a fetched object programmatically with one command?
Something like:
Code:
obj = session.load();
Hibernate.initializeAll(obj);
or with Hql
Code:
"select Obj from Obj left join fetch evertyhing"
or Criteria
Code:
criteria.setFetchMode("*", FetchMode.JOIN)
Background:
I use Hibernate in my RCP desktop application. There was already some discussion how to best integrate Hibernate in a fat client app. I chose the way to only have a session available for some specific operations, and after that work with the detached objects. Often lazy loading is quite handy (sometimes a must, especially adding a new object reference to another object and store the last one back to db), so the standard lazy fetch strategy is globally enabled.
But sometimes I also have to load an object, that is fully initialized, as it will become detached and fully used afterwards.
The problem is, that some objects have so many references and collections, that writing an hql query gets annoying (and error-prone), as I have to use so many times "left join fetch".
So I am looking for one command to initialize the whole object at once (one ring to rule them all ;-)).
Best regards,
Kai