Did any one come across the issue?
Trying to load the data from three tables :
Loan, Applicant, ApplicantDependent
Data is loading into Loan and Applicant but not in ApplicantDependent.
Below are details
Code:
Public class Loan {
private String iLoanID;
private long iLoanNo;
....
....
private Collection iApplicantCollection;
//Constructors
......
//Setters n Getters
}
Public class Applicant {
private String iLoanID;
private String iApplicantID;
private String iApplicantName;
....
....
private Collection iApplicantDependentCollection;
//Constructors
......
//Setters n Getters
}
Public class ApplicantDependent {
private String iLoanID;
private String iApplicantID;
private String iApplicantDependentID;
private String iApplicantDependentName;
....
//Constructors
......
//Setters n Getters
}
//Created for Composite ID's in mapping
Public class ApplicantID {
private String iLoanID;
private String iApplicantID;
....
//Constructors
......
//Setters n Getters
}
Public class ApplicantDependentID {
private String iLoanID;
private String iApplicantID;
private String iApplicantDependentID;
....
//Constructors
......
//Setters n Getters
}
//mapping files
[i]loan.hbm.xml[/i]
<class name="Loan" table="LOAN" dynamic-insert="true" dynamic-update="true">
<id name="loanId" type="string" unsaved-value="any">
<column name="LOANID"/>
<generator class="assigned">
</id>
<property name="loanNo" />
...........
<bag name="applicantCollection" table="APPLICANT" cascade="all" lazy="true" inverse="true">
<key>
<column name="LOANID" not-null="true"/>
</key>
<one-to-many class="Applicant"/>
</bag>
</class>
[i]applicant.hbm.xml[/i]
<class name="Applicant" table="APPLICANT" dynamic-insert="true" dynamic-update="true">
<composite-id class="ApplicantID" >
<key-property name="loanID" />
<key-property name="applicantID" />
</composite-id>
<property name="applicantName" />
...........
<bag name="applicantDependentCollection" table="APPLICANTDEPENDENT" cascade="all" lazy="true" inverse="true">
<key>
<column name="LOANID" not-null="true"/>
<column name="APPLICANTID" not-null="true"/>
</key>
<one-to-many class="ApplicantDependent"/>
</bag>
<many-to-one class="Loan">
<key>
<column name="LOANID" not-null="true"/>
</key>
</many-to-one>
</class>
[i]applicantdependent.hbm.xml[/i]
<class name="ApplicantDependent" table="APPLICANTDEPENDENT" dynamic-insert="true" dynamic-update="true">
<composite-id class="ApplicantDependentID" >
<key-property name="loanID" />
<key-property name="applicantID" />
<key-property name="applicantDependentID" />
</composite-id>
<property name="applicantDependentName" />
...........
...........
<many-to-one class="Applicant">
<key>
<column name="LOANID" not-null="true"/>
<column name="APPLICANTID" not-null="true"/>
</key>
</many-to-one>
</class>