I have 2 table one is Order and other is OrderList.
Order table is having following fields
customerId : foreign key to customer table
applicationId : foreing key to application table
OrderedAt
OrderedOn
OrderList table has to refer order table using applicationId and customerId and having fields:
customerId: foreing key to Order table\
applicationId: foreing key to Order table
OrderItem
Orderprice
I want to map these two in hibernate.xml file
I am not making a seperate file for OrderList.hibernate.xml:
but using below code in Order.hibernate.xml itself
<list name="orders" table="Order_List" cascade="all" access="field">
<key column="applicationId" not-null="true"/>
<key column="customerId" not-null="true"/>
<list-index column="OrderListIndex" />
<composite-element class="OrderList">
<property name="OrderItem" />
<property name="OrderPrice" />
</composite-element>
</list>
Am I using the right way ?