Hello
I am new to Hibernate and am reverse-engineering a legacy database using eclipse and hibernate; I have one outstanding problem I do not know how to solve; I need to edit the raw HBM file to create a set relationship between the two tables for which extreme subsets are shown below.
ADTXTINF has one record for each 'appearance of an ad'; TEXTOFAD has one or more entries for each 'textofad_sys_id' that together make the text of an 'appearance of an ad'; this set of texts may be used by many instances of ADTXTINF.
Hibernate version: 2.x (downloaded jun05)
Database version: Sybase 11.x (legacy system)
Subset Table Definitions:
Code:
ADTXTINF:
adtxtinf_sys_id integer ; the table entry id
...
textofad_sys_id integer ; key to text record set
...
Code:
TEXTOFAD:
textofad_sys_id integer ; paired to be a PK
text_seq_num integer ; ^^
...
Subset Mapping documents:(created by hibernate in eclipse from db)
Code:
Adtxtinf.hbm:
<hibernate-mapping package="com.nxps.advision.extractor">
<class name="Adtxtinf" table="adtxtinf" >
<id name="id" type="integer" column="adtxtinf_sys_id">
<generator class="vm"/>
</id>
<property name="textofadSysId" column="textofad_sys_id"
type="integer" not-null="false" length="10"/>
<!-- details omitted -->
</class>
</hibernate-mapping>
Code:
Textofad.hbm
<hibernate-mapping package="com.nxps.advision.extractor">
<class name="Textofad" table="textofad" >
<composite-id name="id" class="TextofadPK">
<key-property name="textofadSysId" column="textofad_sys_id" type="integer"/>
<key-property name="textSeqNum" column="text_seq_num" type="integer"/>
</composite-id>
<!-- details omitted -->
</class>
</hibernate-mapping>
My requirement:To add an ordered set specification to ADTXTINF::Adtxtinfo.hbm such that the correct set of (ordered) text records from TEXTOFAD::Textofad.hbm is read into Adtxtinfo as specified by adtxtinfo.textofadSysId.
Code:
<set name="textofadSet"........>
</set>
I have successfully made inverse sets for other tables that reference the 'id' of the ADTXTINF in their primary key. I have browsed posts and FAQs, and read the manual on defining sets, but do not see how to achieve this one. Advice or explicit pointer welcome.