Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Is Nested Join possible, mapping a POJO to multiple tables.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic