hi all,
I have got a problem on creating the mapping file for my class, after read the documentation, i found a <composite-id> function, but i am not sure how can I use it to write my mapping file for my class.
2 Tables of my Database, which have one-to-many relation and one of the table has 3 keys. AuctionItem one-to-many BidOnItemLog.
AuctionItem Table
=================
auctionid *
createdate
starttime
endtime
startprice
winner
BidOnItemLog Table
=================
auctionid * (FK)
userid *
datetime *
price
My tables relation , the column in BidOnItemLog Table "auctionid" is a foreign key which is related to the primary key of the AuctionItem Table.
and "userid" and "datetime" are the primary key of BidOnItemLog Table.
Mapping file of AuctionItem Domain Object
Code:
<hibernate-mapping>
<class name="com.twofi.auction.objects.AuctionItem" table="auctionitem">
<id name="auctionid" column="auctionid" unsaved-value="any">
<generator class="increment" />
</id>
<property name="createdate" column="createdate" />
<property name="starttime" column="starttime" />
<property name="endtime" column="endtime" />
<property name="startprice" column="startprice" />
<property name="winner" column="winner" />
</class>
</hibernate-mapping>
Can anyone please kindly to teach me, how can I define the mapping for the BidOnItemLog Objects ?? Thank you very much ! : )