Hi community,
I am a hibernate newbie and a have a (maybe a beginner-) question:
I have these tables in my MySQL database:
SKILLDATA:
ID - Integer - PK
LVL - Integer
DESC - String
ITEM:
ID - Integer - PK
...
SKILLID - Integer - FOREIGN KEY to SKILLDATA.ID
I create a new java class called SkillData.java, add an one-to-many entry and reference the SkillData class in the ItemData.hmb.xml file:
Code:
...
<class name="packageOne.ItemData" table="ITEM">
<many-to-one class="packageOne.ItemSkillData" column="SKILLID" name="itemSkillData"/>
...
</class>
...
<class name="packageOne.ItemSkillData" table="SKILLDATA">
<id column="ID" name="skillId" type="java.lang.Long" unsaved-value="0">
<generator class="native">
<param name="sequence">ITEMSKILLID_SEQ</param>
</generator>
</id>
<property column="LVL" generated="never" lazy="false" name="level" type="integer"/>
<property column="DESC" generated="never" lazy="false" name="description" type="text"/>
</class>
...
Now I've a SkillData object in the ItemData class which contains the corresponding skill level. this works fine!
What I want to implement is a List / Array / Set into the ItemData class which contains all entries (rows) from the table SKILLDATA. This List should save entries as SkillData objects. (e.g. Collection<SkillData> allSkillDataEntries;)How could I realize that? What I've to add/change in the ItemData.hmb.xml and ItemData.java?
Thank you for your help