-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Is Nested Join possible, mapping a POJO to multiple tables.
PostPosted: Wed Feb 17, 2010 7:38 pm 
Newbie

Joined: Wed Feb 17, 2010 7:16 pm
Posts: 1
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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.