Hi everybody,
I'm using the version 2.1.0 of NHibernate coupled with Spring.NET:
I have an object called Lang on which I apply a lazy loading
strategie. How to avoid getting the "failed to lazily initialize a
collection of role NHibernate..." on some properties that I don't want
to be loaded everytime?
Here are the hbm and some part of the code: This concerns the
"_ParentPersons" property that by default should return an empty
collection if I don't want to load it explicitly in my DAO.

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
        <class
name="Credit.Management.Core.Domain.Lang,Credit.Management.Core"
table="LANG" lazy="true" >

                <id name="_Id" column="ID_LANG" type="System.Int32" unsaved-
value="0">
                        <generator class="native"/>
                </id>

    <property name="_Code" type="System.String">
      <column name="[CODE]" sql-type="nvarchar" not-null="true"
length="15" />
    </property>
    <property name="_Label" type="System.String">
      <column name="[LABEL]" sql-type="nvarchar" not-null="true"
length="50" />
    </property>
    <property name="_Description" type="System.String">
      <column name="[DESCRIPTION]" sql-type="nvarchar" not-null="true"
length="250" />
    </property>

    <!-- Activ -->
    <property name="_Activ" type="System.Boolean">
      <column name="[ACTIV]" sql-type="bit" not-null="true" />
    </property>
    <!-- Activ -->

    <property name="_CultureId" type="System.Int32">
      <column name="[CULTUREID]" sql-type="int" not-null="true" />
    </property>

    <bag name="_ParentPersons" table="PERSON" inverse="true"
lazy="true" fetch="select" cascade="none" >
      <key column="L_LANG"  />
      <one-to-many class="Credit.Management.Core.Domain.Person,
Credit.Management.Core"/>
    </bag>

  </class>
</hibernate-mapping>

Does someone has an idea how to implement this behaviour?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to