Hi-

I've got an object I need to lazy load via the no-proxy mechanism.
Unfortunately, I cannot seem to get it to load properly -- I continue
to get a proxy when I load the parent.

My test entities are Foo, which has a Favorite Bar; and Bar1/Bar2
which are subclasses of Bar based on a discriminator.  (I also tried
with table-per-subclass.)

I'm using Fluent NHibernate 1.1.0.685 / NHibernate 2.1.2.4000, with
the ProxyFactoryFactory set to use ByteCode.Castle, and default-
lazy="true".

When I get a Foo, the Favorite property is a BarProxy that cannot be
cast to Bar1 or Bar2.

Any suggestions on debugging this problem, or ideas where I am going
wrong?
Thanks!
-Eric.

Here's the NHibernate mapping that Fluent NHibernate generates:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="property" auto-import="false" default-cascade="none" default-
lazy="true">
  <class xmlns="urn:nhibernate-mapping-2.2" dynamic-update="true"
mutable="true" name="Foo" table="temp_foo">
    <id name="Id" type="System.Nullable`1[[System.Int32]]">
      <column name="id" />
      <generator class="assigned" />
    </id>
    <many-to-one class="Bar" lazy="no-proxy" name="Favorite">
      <column name="favorite_bar_id" />
    </many-to-one>
  </class>
</hibernate-mapping>


<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="property" auto-import="false" default-cascade="none" default-
lazy="true">
  <class xmlns="urn:nhibernate-mapping-2.2" dynamic-update="true"
mutable="true" name="Bar" table="temp_bar">
    <id name="Id" type="System.Nullable`1[[System.Int32]]">
      <column name="id" />
      <generator class="assigned" />
    </id>
    <discriminator type="String">
      <column name="type" />
    </discriminator>
    <bag inverse="true" name="FavoriteOf" mutable="true">
      <key>
        <column name="favorite_bar_id" />
      </key>
      <one-to-many class="Foo" />
    </bag>
    <subclass name="Bar1" discriminator-value="1">
      <property name="Name" type="System.String">
        <column name="name" />
      </property>
    </subclass>
    <subclass name="Bar2" discriminator-value="2">
      <property name="Description" type="System.String">
        <column name="xxxx" />
      </property>
    </subclass>
  </class>
</hibernate-mapping>

-- 
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