I tried reading Hibernate documentation.Hibernate One-To-One
Fetch is optional – defaults to “select”, and lazy is optional – and defaults to “proxy”. So, if I do not supply either of them, will it default to “eager fetching” and not causing lazy instantiation exception?
Thanks in advance.
From the docs (http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/performance.html): “By default, Hibernate3 uses lazy select fetching for collections and lazy proxy fetching for single-valued associations. These defaults make sense for most associations in the majority of applications.”
So yes, if you don’t explicitly set to eager, it should default to lazy.