Skip to content

Session.Refresh when entity is IFieldInterceptorAccessor throws a MappingException #2928

Closed
@marjohansson

Description

@marjohansson

When having an entity with lazy properties and doing Session.Refresh(entity) an exception is thrown.

Below is the mapping used.

The exception : NHibernate.MappingException: 'No persister for: RecipientBinderProxyForFieldInterceptor'

When removing the lazy props, no exception occurs.

Using 5.3.10

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="X.Domain"
                   namespace="X.Domain.Entities">

  <class name="RecipientBinder" table="MonitorRecipientBinder">
    <id name="Cid">
      <generator class="native"/>
    </id>

    <many-to-one name="MonitorType" class="MonitorType" column="MonitorType_cid"/>
    <many-to-one name="Customer" class="Customer" column="Customer_cid"/>
    <many-to-one name="CustomerContact" class="CustomerContact" column="CustomerContact_cid"/>

    <property name="Description" length="255"/>


    <property name="UnitCount" lazy="true" formula="(SELECT COUNT(u.Cid) FROM Unit u WHERE (u.MonitorRecipientBinder_cid = Cid OR u.MonitorCustomerRecipientBinder_cid = Cid) AND u.IsDeleted = 0 AND u.Status_cid in (72,73))"/>
    <property name="RecipientCount" lazy="true" formula="(SELECT COUNT(r.Cid) FROM MonitorRecipientBinderItem r WHERE r.Binder_cid = Cid)"/>


    <bag name="Items" mutable="false">
      <key column="Binder_cid"/>
      <one-to-many class="RecipientBinderItem"/>
    </bag>

  </class>

</hibernate-mapping>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions