stateless session - Nhibernate StatelessSession and Lazy Loading -


i tried develope "sessionwrapper". idea behind able switch stateful session stateless session easily, no modifications daos , xml mapping files.

mapping looks this:

<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="domain" assembly=domain">   <class name="batchscheduling" table="dbo.batch_scheduling">     <id name="id" column="batch_scheduling_id">       <generator class="native" />     </id>      <property name="name" column="batch_scheduling_name" not-null="true" />     <property name="description" column="batch_scheduling_description" not-null="true" />     <property name="type" column="batch_scheduling_type" not-null="true" />     <property name="cron" column="batch_scheduling_cron" not-null="true" />     <property name="datemodified" column="batch_scheduling_date_modified" not-null="true" />      <bag name="parameters" cascade="all" table="dbo.batch_scheduling_parameters" lazy="true" inverse="true">       <key column="batch_scheduling_id"/>       <one-to-many class="batchschedulingparameter"/>     </bag>    </class> </hibernate-mapping> 

i knew stateless sessions not support lazy loading. expected session eager fetch related objects/collections declared in mapping.

however, when try access batchscheduling.parameters following exception:

nhibernate.lazyinitializationexception: initializing[domain.batchscheduling#22]-failed lazily initialize collection of role: domain.batchscheduling.parameters, no session or session closed 

any idea?

i knew stateless sessions not support lazy loading. expected session eager fetch related objects/collections declared in mapping.

that result in entire database being loaded memory, , in 80-90% of cases result in way more queries necessary , render stateless session useless.

one approach can use eagerly fetch relationships need, using setfetchmode


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -