title: collection is not associated with any session + Caused by: org.hibernate.LazyInitializationException: illegal access to loading collection
body: <p>hbm file: </p>
  
  <p>
   </p>
  
  <p></p>
  
  <pre><code>&lt;class name="com.shaklee.productCatalogue.persistence.CategoryMasterDBVO" table="PRD_CATEGORY_MASTER" lazy="false"&gt;
      &lt;meta attribute="implement-equals" inherit="false"&gt;true&lt;/meta&gt;
      &lt;meta attribute="extra-import" inherit="false"&gt;java.math.BigDecimal&lt;/meta&gt;
  
      &lt;cache usage="nonstrict-read-write"/&gt;
  
      &lt;!-- Unique identifier --&gt;
      &lt;id name="categoryGuid" column="category_guid" type="java.lang.Long"&gt;
          &lt;meta attribute="scope-set"&gt;protected&lt;/meta&gt;
          &lt;generator class="com.quinstreet.persistence.GuidGenerator"/&gt;
      &lt;/id&gt;
  
      &lt;!--  self reference --&gt;
      &lt;many-to-one name="parent" column="CATEGORY_PARENT_GUID"
          class="com.shaklee.productCatalogue.persistence.CategoryMasterDBVO" /&gt;
  
      &lt;set name="children" cascade="none" inverse="false" lazy="false"&gt;
          &lt;key column="CATEGORY_PARENT_GUID"/&gt;
          &lt;one-to-many class="com.shaklee.productCatalogue.persistence.CategoryMasterDBVO"/&gt;
      &lt;/set&gt;
  
      &lt;set name="assignedProducts" table="PRD_PRODUCT_CATEGORY" lazy="false" batch-size="25" cascade="none"&gt;
          &lt;key column="CATEGORY_GUID" /&gt;
          &lt;many-to-many column="PRODUCT_GUID"
              class="com.quinstreet.persistence.product.ProductDBVO" /&gt;
      &lt;/set&gt;
  
      &lt;idbag name="details" table="PRD_CATEGORY_MASTER_L10N" lazy="true"
          batch-size="25"&gt;
          &lt;cache usage="nonstrict-read-write"/&gt;
  
          &lt;collection-id type="long" column="guid"&gt;
              &lt;meta attribute="scope-set"&gt;protected&lt;/meta&gt;
              &lt;generator class="com.quinstreet.persistence.GuidGenerator"&gt;&lt;/generator&gt;
          &lt;/collection-id&gt;
  
          &lt;key column="CATEGORYGUID" foreign-key="FK_PRD_CATEGORY_MASTER_L10N_CATEGORY" /&gt;
  
          &lt;composite-element
              class="com.shaklee.productCatalogue.persistence.CategoryMasterl10nDetailsDBVO"&gt;
              &lt;meta attribute="implements"&gt;com.quinstreet.domain.product.CategoryMasterl10nDetails
              &lt;/meta&gt;
              &lt;meta attribute="extends"&gt;com.quinstreet.domain.l10n.AbstractL10nDetails
              &lt;/meta&gt;
              &lt;meta attribute="implement-equals" inherit="false"&gt;true&lt;/meta&gt;
  
              &lt;many-to-one name="localeDbvo"
                  class="com.quinstreet.persistence.l10n.LocaleDBVO" column="localeGuid"
                  not-null="true" foreign-key="FK_PRD_CATEGORY_MASTER_L10N_LOCALE"
                  cascade="none"&gt;
                  &lt;meta attribute="property-type"&gt;com.quinstreet.persistence.l10n.LocaleDBVO
                  &lt;/meta&gt;
                  &lt;meta attribute="use-in-equals"&gt;true&lt;/meta&gt;
              &lt;/many-to-one&gt;
              &lt;many-to-one name="realmDbvo"
                  class="com.quinstreet.persistence.context.RealmDBVO" column="realmGuid"
                  not-null="true" foreign-key="FK_PRD_CATEGORY_MASTER_L10N_REALM"
                  cascade="none"&gt;
                  &lt;meta attribute="property-type"&gt;com.quinstreet.persistence.context.RealmDBVO
                  &lt;/meta&gt;
                  &lt;meta attribute="use-in-equals"&gt;true&lt;/meta&gt;
              &lt;/many-to-one&gt;
  
              &lt;property name="categoryName" type="string" /&gt;
  
          &lt;/composite-element&gt;
  
      &lt;/idbag&gt;
  
  &lt;/class&gt;
  </code></pre>
  
  <p></p>
  
  <p>Error I m getting is:</p>
  
  <p>org.springframework.orm.hibernate3.HibernateSystemException: illegal access to loading collection; nested exception is org.hibernate.LazyInitializationException: illegal access to loading collection</p>
  
  <p>on browser I get error as:
  org.apache.jasper.JasperException: org.springframework.orm.hibernate3.HibernateSystemException: collection is not associated with any session; nested exception is org.hibernate.HibernateException: collection is not associated with any session
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:541)</p>
  
  <p>I m u sing the hibernatetemplate as: </p>
  
  <pre><code>public List&lt;CategoryMasterDBVO&gt; getAllMainCategories() {
  return getHibernateTemplate().loadAll(CategoryMasterDBVO.class);
  }
  </code></pre>
  
  <p>Please advice.</p>
  
  <p>Thanks</p>