I know hibernate's default fetching strategy is LAZY for collections, is there a way to change the default fetching strategy system wide through configuration file?
+2
A:
I don't know any good answer for your need, sorry. :-(
But may I dare challenging your requirement? ;-)
If you enable early fetching for collections (ie. XToMany, or parent to child relationship), it is probable that it is also adequate to enable the other side (XToOne), that is much more likely needed.
Considering that often, your entities are not fully partitionned, that is "there is a chain of entities allowing to go from any entity to any other entity"...
We deduce that even your simplest request will load the entire database !
This is the reason why I think it is "unlikely a good idea".
KLE
2009-10-01 07:37:15
+1. Setting **all** associations to be eagerly fetched is **never** a good idea.
ChssPly76
2009-10-01 17:18:52
I was trying to set global fetching strategy to lazy
nimcap
2009-10-02 06:24:29