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 
					
  
						
					 | 
				 
				 
			 |