Joined: Sat Dec 02, 2006 12:53 pm Posts: 1
|
I have the following two persistent classes representing tables:
public class Item {
private int id;
private String item;
private String description;
private List components;
}
public class ItemComponents {
private int id;
private String parentItem;
private String componentItem;
private double quantityPerUnit;
}
I want to establish an association as follows (I will use SQL syntax:)
select * from ItemComponents
where ItemComponents.parentItem=Item.item
If tried the following mapping, but it does not work properly:
<class name "domain.Item" table="Item">
<id name="id" column="id" type="int">
<generator class="native"/>
</id>
<property name="item" type="string" column="item"/>
<property name="description" type="string" column="description"/>
<list name="components" table="ItemComponent">
<key column="item"/>
<one-to-many class="domain.ItemComponent" column="parentItem"/>
</list>
</class>
I assume this kind of association can be defined in Hibernate. What is the proper syntax?
Thank you
|
|