| 
					
						 I have a parent table Employee and a child table Employee_Address
 
 Primary key of Parent empId Composite key of child empAddressId and accountNumber
 
 Parent table has accountNumber  as a column Child table has empId as a column
 
 I am unable to set one-tomany association in this scenario
 
 Here is my Employee (PARENT) mapping file
 
 <hibernate-mapping>
     <class name="Employee" table="EMPLOYEE">
         <id name="empId" type="long">
             <column name="EMP_ID" precision="15" scale="0" />
             <generator class="assigned" />
         </id>
         <property name="acctNo" type="string">
             <column name="ACCT_NO" length="5" not-null="true" />
         </property>
 
         
                 <set name="empAddresses" inverse="true" lazy="true">
             <key>
                 <column name="empId"/>
                 
             </key>
             <one-to-many class="EmpAddress" />
         </set>
  
     </class>
 </hibernate-mapping>
 
 
 Java BEAn for Employee is very standard with all the getters/setters
 
 
 EmployeeAddress (CHILD) mapping file: 
 
 <hibernate-mapping>
     <class name="EmpAddress" table="POL_INT_ADDRESS">
         
                 
         <composite-id name="id" class="EmpAddressKey">
 			<key-property name="addressId"/>
 			<key-property name="acctNo"/>
 			<key-property name="empId"/>
 		</composite-id>
         
         
         <many-to-one name="emp" class="Employee" insert="false" update="false" fetch="join">
             <column name="empId"/>            
         </many-to-one>
         <property name="xval" type="long">
             <column name="X_VAL" precision="15" scale="0" not-null="true" />
         </property>
         <property name="yVal" type="int">
             <column name="Y_VAL" not-null="true" />
         </property>
 </class>
 </hibernate-mapping>
 
 
 Java code for the composite key EmpAddresskey
 public class EmpAddressKey implements Serializable{
 	
 	
 		private String acctNo;
 		private long empAddressId;
 		private long empId;
 
 		public EmpAddressKey(long empAddressId, String acctNo, long empId) {
 ///intialize parametrs			
 		}
 
 //getters/setters for empAddressId, empId, acctNo
 
 //equals and has code methods also implemented
 
 }
 
 
 When I run Session.load(Employee)...I get the result set for Employee (PARENT ) table but the collections size for EmpAddress is Zero.
 
 
 Can someone point me in right direction. Anything wrong with the mapping??? I get Error:could not load an entity: [Employee#1234] 
					
  
						
					 |