Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

<field name="group" type="myapp.ProductGroup" ><sql name="group_id" cascading="create"/></field>

<field name="details" type="myapp.ProductDetail"collection="vector"><sql many-key="prod_id"/></field>

...

Cascading with the "product" class as operation class only works if we use long transaction [see: update]

<class name="myapp.Product" identity="id">

<map-to table="prod" />

<field name="id" type="integer">
<sql name="id" type="integer" />
</field>

<field name="name" type="string">
<sql name="name" type="char" />
</field>

<field name="price" type="float">
<sql name="price" type="numeric" />
</field>

<field name="group" type="myapp.ProductGroup" >
<sql name="group_id" />
</field>

<field name="details" type="myapp.ProductDetail" collection="vector">
<sql many-key="prod_id" cascading="update"/>
</field>

<field name="categories" type="myapp.Category" collection="vector">
<sql name="category_id"
many-table="category_prod" many-key="prod_id" />
</field>
</class>

The following code fragment shows the corresponding mapping entry for the ProductDetail class that defines the second leg of the 1:M relation between Product and ProductDetail.

...

<field name="product" type="myapp.Product"><sql name="prod_id" cascading="all"/></field>

</class>

M:N relation still to implement!

...