Win a copy of Rust Web Development this week in the Other Languages forum!

Nishant Varma

Greenhorn
+ Follow
since Feb 17, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nishant Varma

Hi.
I am trying to map a POJO LoanSearchDTO.java to multiple tables.
Tables LOAN_ST and LOAN_CONT_ALLTN are associated to table LOAN through ID_LOAN.
Table CASH_CONT is associated to table LOAN_CONT_ALLTN through ID_LOAN_PCH_CONT.
This means tables LOAN and CASH_CONT are associated through table LOAN_CONT_ALLTN
(a kind of transitive association)
I could map all tables to Loan through ID_LOAN using Join, however am struggling to Join CASH_CONT.

My mapping file looks as follows:-
<hibernate-mapping>
<class name="LoanSearchDTO" table="LOAN">
<id name="LoanId" type="long">
<column name="ID_LOAN" />
<generator class="assigned" />
</id>
<property name="borrowerLastName" column="NAME_BORR_LST" type="string"/>

<join table="LOAN_ST">
<key column="ID_LOAN"/>
<property name="loanStatusCode" column="CD_LOAN_ST" type="int"/>

</join>

<join table="LOAN_CONT_ALLTN">
<key column="ID_LOAN"/>
<property name="contractNumber" column="ID_LOAN_PCH_CONT" type="long"/>
</join>
<hibernate-mapping>

Question: how do I specify mapping to CASH_CONT table. I tried Nested Join like below however that does not seem to
work.
This does not work:
<join table="LOAN_CONT_ALLTN">
<key column="ID_LOAN"/>
<property name="contractNumber" column="ID_LOAN_PCH_CONT" type="long"/>
<join table="CASH_CONT">
<key column="ID_LOAN_PCH_CONT"/>
<property name="contractExpiryDate" column="DT_CONT_EXPTN" type="Date"/>
</join>
</join>

Is there any other approach?

Would really appreciate any help. Thank You!