-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Requesting advice on definiig set relationship in HBM file
PostPosted: Thu Jun 16, 2005 7:35 pm 
Newbie

Joined: Wed Jun 15, 2005 2:55 pm
Posts: 1
Location: Sacramento CA
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.