I have read the article you pointed me to. My problem is this, I have a parent class which can have any number of associated child items. The parent ID is used as a foreign key in the child class. How can I acheive the same thing by implementing a 'a good equals() method'?? - (
www.hibernate.org/109.html - Seperating object id and business key).
My maps are as follows:
[b]Order.htm.xml[b/]
<hibernate-mapping package="test">
<class name="Order" table="orderstbl">
<id name="ID" column="order_id" type="string" unsaved-value="null">
<generator class="uuid.hex"/>
</id>
<property name="OrderDate" column="order_date" type="timestamp" not-null="true"/>
<property name="PriceTotal" column="price_total" type="double" not-null="true"/>
<property name="UserID" column="user_id" type="integer" not-null="true"/>
<set name="OrderItems" table="orderitemstbl" inverse="true" cascade="all">
<key column="order_id"/>
<one-to-many class="OrderItem"/>
</set>
</class>
</hibernate-mapping>
[b]OrderItems.hbm.xml[b/]
<hibernate-mapping package="test">
<class name="OrderItem" table="orderitemstbl">
<id name="ID" column="orderitem_id" type="string" unsaved-value="null">
<generator class="uuid.hex"/>
</id>
<property name="OrderID" column="order_id" type="string" not-null="true" insert="false" update="false"/>
<property name="StockID" column="stock_id" type="string" not-null="true" insert="false" update="false"/>
<property name="Amount" column="amount" type="integer"/>
<property name="Price" column="price" type="double"/>
<many-to-one name="Order" class="Order" column="order_id" />
<many-to-one name="Stock" class="Stock" column="stock_id"/>
</class>
</hibernate-mapping>
many thanks in advance
Andrew