Hi there, I have what I think should be a simple problem, which is causing me to bang my head against the wall.
The scenario is this, I have two tables:
Code:
TABLE_A
======
ID
NAME
DESC
REF_LOAN_NUM
TABLE_B
======
ID
FNAME
LNAME
LOAN_NUM
Now, what I would like to have is one object:
Code:
public class A {
Integer id;
String name;
String description;
String clientFirstName;
String clientLastName;
//all getters/setters here//
}
I would like a Mapping document for A such that there is a join between TABLE_A and TABLE_B where TABLE_A.REF_LOAN_NUM = TABLE_B.LOAN_NUM. I know this database schema is a$$, but I didn't design it! I just have to live with it.
Anyone have any clue how I might do this? I thought I could get away with adding this entry to the mapping document:
Code:
<join table="TABLE_B">
<key column="REF_LOAN_NUM" property-ref="LOAN_NUM"/>
<property name="clientLastName"
column="LNAME"
type="string"/>
<property name="clientFirstName"
column="FNAME"
type="string"/>
</join>
However I soon realized that "property-ref" doesn't accept a column name.
Thanks.