Hi
I have a problem like this. Can anyone help me?
Table1
id, code1, code2
========================
Table2
id, code3, code4
========================
class Table1
{
private Long id;
private Long code1;
private Long code2;
private Long code3
}
the relationship between these tables is one-to-one(code1 from Table1=id from Table2)
========================
in mapping xml for Table1
...
<property "code1"/>
<property "code2"/>
....
========================
query
List list =
session.createSQLQuery("select " +
"T1.id as {Table1.id} , " +
"T1.code1 as {Table1.code1} , " +
"T1.code2 as {Table1.code2} , " +
"T2.code3 ????} "
" from Table1 T1 right outer join Table2 T2 on T1.code1 = T2.id " +
" where T1.id = 1")
.addEntity("Table1", Table1.class).list();
i want to get data form Table2 without mapping fields code3, code4 from Table2.
Can i do this(hibernate want mapping for code3, code4 but they are in different table not in Table1)?
If i can't - any idea how can i resolve my problem?
Best regards,
cool_boy1
|