I have the following mapping:

  <class name="Person" proxy="Person" table="Person_">

    <id name="OID" column="OID_" type="Guid">
      <generator class="guid.comb"/>
    </id>

    <version name="Version" column="Version_"/>

    <set name="Properties" lazy="true" inverse="true" cascade=
"all-delete-orphan">
      <key column="PersonOID_"/>
      <one-to-many class="Property"/>
    </set>

  </class>


And the following class:


public class Person
{
        private Iesi.Collections.Generic.ISet<Properties> _properties;

        public void AddProperty(Property property)
        {
            p.Person = this;
            _properties.Add(p);
        }

        public void RemoveProperty(Property property)
        {
            p.Person = null;
            _properties.Remove(p);
        }
}

...

public void TransferProperty(Property p, Person thisPerson, Person 
otherPerson)
{
     //thisPerson.RemoveProperty(property);
     otherPerson.AddProperty(property);
}

Calling TransferProperty results in otherPerson's version getting 
incremented, but thisPerson's version is unchanged.  So when multiple users 
try to call TransferProperty at the same time -- no persistence exception 
gets thrown.


*What should I do, so that both thisPerson and otherPerson get their 
versions incremented by the call to TransferProperty ???*
Thanks,
Peter

P.S. I tried calling RemoveProperty, but that resulted in an exception -- 
"NHibernate.ObjectDeletedException: deleted object would be re-saved by 
cascade (remove deleted object from associations)."


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to