I Found this solution:

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
        <class
name="TreeViewForBD.Data.Property.PGenericProperty,FondData"
table="P_GENERIC_PROPERTY" lazy="true" dynamic-insert="true" dynamic-
update="true">

                <id access="nosetter.lowercase-underscore"
name="InstanceS"
column="INSTANCE_S" type="String" >
                        <generator class="assigned"/>
                </id>
                <property access="nosetter.lowercase-underscore"
column="ACTIVITY_S"
name="ActivityS" type="String"/>

    <one-to-one access="nosetter.lowercase-underscore"
class="TreeViewForBD.Data.Property.PGenericPropertyLu,FondData"
name="LastUpdatedLu" fetch="join" cascade="all"/>
    <join table="P_GENERIC_PROPERTY_LU" optional="true">
      <key column="INSTANCE_S"/>
      <property access="nosetter.lowercase-underscore"
column="LAST_UPDATED" type="DateTime" name="LastUpdated"/>
      ....
    </join>
  </class>

  <class
name="TreeViewForBD.Data.Property.PGenericPropertyLu,FondData"
table="P_GENERIC_PROPERTY_LU" lazy="false">
    <id access="nosetter.lowercase-underscore"  name="InstanceS"
column="INSTANCE_S" type="String" >
      <generator class="assigned"/>
    </id>
  </class>
</hibernate-mapping>

In PGenericProperty class:
...
public virtual string LastUpdated               {
  get { return _lastUpdated; }
  set
  {
    if( value != null &&  value.Length > 15) throw new
ArgumentOutOfRangeException("Invalid value for TimeValueU", value,
value.ToString());

    bool isChangedLocal = (_timevalueu != null && value !=
String.Empty && _timevalueu != value);
    if (isChangedLocal)
    {
        this.CheckPgpUnusedExists();
    }

    _isChanged |= isChangedLocal; _timevalueu = value;
   }
}

private PGenericPropertyUnused _lastupdatedlu;

public virtual PGenericPropertyLu LastUpdatedLu
{
    get
    {
        return this._lastupdatedlu;
    }
    set
    {
      this._lastupdatedlu = value;
    }
 }

/// <summary>
/// Проверить, есть ли экземпляр класса PGenericPropertyUnused
/// </summary>
private void CheckPgpUnusedExists()
{
     if (this.LastUpdatedLu == null)
     {
         this.LastUpdatedLu = new PGenericPropertyUnused();
         this.LastUpdatedLu.InstanceS = this.InstanceS;
     }
}
...



After change LastUpdated create instance PGenericPropertyLu if not
exists for tell NHibernate send Insert before Update.

PGenericPropertyLu store IsSaved state for self and Interceptor parse
this as Saved/Unsaved state this entity.

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