when I am setting up my fluent mappings, what is the default for collections? Do I need to explicitly set them as lazy-load, or is that the default?
Any association, whether it be a many-to-one or a collection is lazy loaded by default, it requires an Open ISession. If you have closed your session, or if you have committed your transaction, you can get a lazy load exception that it cannot pull in those additional objects.
Lazy loading is the process whereby an entity or collection of entities is automatically loaded from the database the first time that a property referring to the entity/entities is accessed. Lazy loading means delaying the loading of related data, until you specifically request for it.
A fetching strategy is the strategy NHibernate will use for retrieving associated objects if the application needs to navigate the association. Fetch strategies may be declared in the O/R mapping metadata, or overridden by a particular HQL or Criteria query.
Note this is changed as of current day to be inline with NHibernate standards which is lazy loading is enabled by default for everything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With