Hello Everyone

I have a project with two entities, normal parent -> child
relationship. Here the mappings

<class name="Allocation">
        <id name="Id">
            <generator class="guid.comb"></generator>
        </id>

        <version name="Version" />

        <property name="Title" length="255" not-null="true"/>
        <property name="Description" type="StringClob" />
        <property name="Location" length="255" />
        <property name="From" column="`From`"/>
        <property name="To" column="`To`"/>
        <property name="State"
type="NHibernate.Type.EnumStringType`1[[ISolutions.EasyPlanner.Data.Entity.AllocationState,
ISolutions.EasyPlanner.Data]], NHibernate"/>
        <property name="IsSendMailNotification" />
        <property name="CanEnableSendingInvitation" />
        <property name="CreatedBy" length="255" />
        <property name="LastModifiedBy" length="255" />
        <property name="CreatedAt"/>
        <property name="LastModifiedAt" />

        <bag name="Resources" cascade="all" lazy="false" >
            <key column="AllocationId" />
            <one-to-many class="ResourceAllocation"/>
        </bag>
        <many-to-one name="Category" column="CategoryId"
class="Category" cascade="none" lazy="false" />
    </class>

    <class name="ResourceAllocation">
        <id name="Id">
            <generator class="guid.comb"></generator>
        </id>
        <property name="ResponseState" column="InvitationResponse"
 
type="NHibernate.Type.EnumStringType`1[[ISolutions.EasyPlanner.Data.Entity.InvitationResponseState,
ISolutions.EasyPlanner.Data]], NHibernate" />
        <many-to-one name="Resource" column="ResourceId"
class="Resource" cascade="none" lazy="false"/>
    </class>

Where Allocation points to ResourceAllocation.
By Default we start always a transaction before call SaveOrUpdate and
Commit the transaction after the saveOrUpdateCall.
Now when multiple Users update the same allocation at the same time,
the sql server might run in a dead lock, becausae it does not always
lock the ResourceAllocations in the same order.

When I call Session.Lock(Allocation) before SaveOrUpdate, I got an
error, that the item has arrays that have changed values. So what can
I do, that ResourceAllocations are also locked when saving an
Allocation?

Thanks for you're help

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