Joined: Sat Feb 21, 2004 3:02 pm Posts: 14
|
I am finding that Hibernate does a great job of mapping a key to an object when the foeeigh key is a column in hte
table as below where CustomerID maps to CustomerImpl
<class name="com.microsoft.northwind.impl.OrderImpl" table="Orders" >
<id name="OrderID" type="int" unsaved-value="null" >
<column name="OrderID" sql-type="int identity" not-null="true" />
<generator class="hilo" />
</id>
<many-to-one name="Customer" column="CustomerID" class="com.microsoft.northwind.impl.CustomerImpl" not-null="false" />
<many-to-one name="Employee" column="EmployeeID" class="com.microsoft.northwind.impl.EmployeeImpl" not-null="false" />
...
</class>
The problem comes where the properties are part of the key
Below I would like to make OrderID map to OrderImpl and
ProductID map to ProductImpl
<class name="com.microsoft.northwind.impl.OrderDetailImpl" table="Order Details" >
<composite-id >
<key-property name="OrderID" type="int" column="OrderID" />
<key-property name="ProductID" type="int" column="ProductID" />
</composite-id>
<property name="unitPrice" column="UnitPrice" type="double" not-null="true" />
<property name="quantity" column="Quantity" type="int" not-null="true" />
<property name="discount" column="Discount" type="real" not-null="true" />
</class>
any hints as to how
_________________ Steven M. Lewis PhD
4221 105th Ave NE
Kirkland, WA 98033
425-889-2694
206-384-1340 (cell)
|
|