Joined: Mon Feb 19, 2007 5:18 pm Posts: 3 Location: Columbus, Ohio
|
Nhibernate version: 1.2.0.4000
I have two classes a Car and a Wheel. A Car has a bag of wheels:
_____________________________________________________
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="nhibernateProj" namespace="nhibernateProj" >
<class name="Car" table="Cars"
lazy="false" dynamic-update="true" optimistic-lock="version" select-before-update="true" >
<id column="UniqueID" name="mUniqueID" type="int" access="field">
<generator class="native"/>
</id>
<timestamp column="timestamp" name="mTimestamp" access="field"/>
<bag name="mWheels" cascade="all" lazy="false" inverse="true" access="field">
<key column="CarUniqueID"/>
<one-to-many class="nhibernateProj.Wheel" />
</bag>
</class>
</hibernate-mapping>
________________________________________________________
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="nhibernateProj" namespace="nhibernateProj" >
<class name="Wheel" table="Wheels"
lazy="false" dynamic-update="true" optimistic-lock="version" select-before-update="true" >
<id column="UniqueID" name="mUniqueID" type="int" access="field">
<generator class="native"/>
</id>
<timestamp column="timestamp" name="mTimestamp" access="field"/>
<many-to-one column="CarUniqueID" name="mCarIBelongTo" cascade="none" access="field"/>
</class>
</hibernate-mapping>
_________________________________________________________
Problem: Call Session.delete on a Car that has wheels. First the Car's version is updated, then deletes of wheels. Then the car is deleted. Why is an update to the car's timestamp necessary before delete?
If you remove the bag or the versoning from the equation, no update is called.
I have sample project ready if necessary.
[/b]
|
|