-->
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: Composite ID one-to-many problem
PostPosted: Thu Dec 04, 2003 7:28 am 
Newbie

Joined: Mon Dec 01, 2003 7:00 am
Posts: 16
Hi Hibernate Users,

My database table structure is as follows

Table A
{
Composite key :- PatId
PaticipantId
}
Table B
{
Primary Key :- AdmissionId
and
Patid
ParticipantId
}

Table A have one to many relationship with Table B
Table B has many to one relationship with Table A

<class name="TCx1PtsiteT" table="A">
<composite-id unsaved-value="any" >
<key-many-to-one name="Participant" class="TCx1ParticipantM" column="Participant_ID"/>
<key-many-to-one name="Patient" class="TCx1PatientT" column="PatID"/>
</composite-id>
<one-to-one name="accPatient" class="TA3PatientT" constrained="true" outer-join="false"/>
<bag name="admParticipant" inverse="true" lazy="true" cascade="all">
<key column="Participant_ID"/>
<one-to-many class="TCx1AdmdisT"/>
</bag>
<bag name="admPatient" inverse="true" lazy="true" cascade="all">
<key column="PatID"/>
<one-to-many class="TCx1AdmdisT"/>
</bag>
</class>


<class name="TCx1AdmdisT" table="B">
<id name="primary" column="Admission_ID" type="long" unsaved-value="null">
<generator class="native"/>
</id>
<property name="admitdt" column="AdmitDt" type="timestamp" length="23" not-null="true"/>
<property name="dischdt" column="DischDt" type="timestamp" length="23"/>
<property name="patient" column="PatID" type="integer" />
<property name="participant" column="Participant_ID" type="string" length="50"/>
<one-to-one name="accAdmDis" class="TA3AdmdisT" constrained="true" outer-join="false" />
<bag name="labVisit" inverse="true" lazy="true" cascade="all">
<key column="Admission_ID"/>
<one-to-many class="TCx1LabvisitT"/>
</bag>
</class>

Is this correct way to map ?
Please Respond me.

Devesh


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.