I've got something insane going on.  Something is trying to renumber a
primary key!

My transaction fails at the end, doing...

UPDATE asset_instance
SET    asset_instance_id = 1 /* ?p0 */
WHERE  asset_instance_id = 38 /* ?p1 */

...which inevitably blows MySQL up.

Doesn't look right to me.

I have an Order which has many Assets which in turn has many
AssetTemporals.

I've set it to cascade through both relationships as cascade="all".
All the logic is inside asset / order.  Asset temporals are hidden
inside, so I'm using field access for everything.  Using NH 2.0.1/
MySQL.

Mapping defined as follows:

<!-- order -->
  <class name="Order" table="asset_order">
    <id name="_id" column="asset_order_id">
      <generator class="native" />
    </id>
    <property name="_orderNumber" column="order_number" unique="true"
not-null="true" unique-key="OrderNumberKey" />
    <property name="_dateCreated" column="date_created" not-
null="true" />
    <bag name="_assets" table="asset_instance" order-by="description"
cascade="all">
      <key column="asset_instance_id" />
      <one-to-many class="Asset"/>
    </bag>
  </class>

  <!-- asset -->
  <class name="Asset" table="asset_instance">
    <id name="_id" column="asset_instance_id">
      <generator class="native" />
    </id>
    <many-to-one class="Order" column="asset_order_id" name="_order" /
>
    <property name="_description" column="description" />
    <bag name="_assetTemporals" table="asset_temporal" cascade="all">
      <key column="asset_temporal_id" />
      <one-to-many class="AssetTemporal"/>
    </bag>
  </class>

  <!-- asset temporal -->
  <class name="AssetTemporal" table="asset_temporal">
    <id name="_id" column="asset_temporal_id">
      <generator class="native" />
    </id>
    <many-to-one class="Asset" name="_asset"
column="asset_instance_id" />
    <property name="_dateStamp" column="date_stamp" />
    <many-to-one class="Company" name="_owner" column="company_id" />
    <property name="_ownerName" column="owner_name" />
    <property name="_assetNumber" column="asset_number" />
    <property name="_serialNumber" column="serial_number" />
    <property name="_notes" column="notes" />
    <many-to-one class="Staff" name="_changedBy"
column="changed_staff_id" />
  </class>

Any ideas?  I'm completely stuck.

Cheers,

Chris Smith
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to