Hello,
so. here is my problem:
I have 2 tables
Table A
{
ID integer,
column1 integer
column2 integer
.
.}
Table B{
ID integer,
ID_fromTabA integer,
PROP_TYPE integer,
PROP_STRING,
.
.}
And my class:
Code:
class ObjectWithProps{
Inteder id;
String prop1;
String prop2;
...
String propN;
}
I know that for object with id=1 in table A
must be properties in table B in form
Code:
[b]for prop1:[/b]
ID_fromTabA = 1,
PROP_TYPE = 1,
PROP_STRING = "aaaaaaa"
[b]for prop2:[/b]
ID_fromTabA = 1,
PROP_TYPE = 2,
PROP_STRING = "bbbb"
so in map xml i created this:
<class name="ObjectWithProps" table="tableA"
.
.
<property name="prop1" type="string" column="tableB" update="false" insert="false"
formula= "(SELECT tableB.pro_string FROM tableB WHERE tableB.id_fromTabA=id AND prop_type=1)"
/>
<property name="prop2" type="string" column="tableB" update="false" insert="false"
formula= "(SELECT tableB.pro_string FROM tableB WHERE tableB.id_fromTabA=id AND prop_type=2)"
/>
and this works, but SQL generated from Hibernate is in form:
SELECT ...... (SELCET SELECT tableB.pro_string FROM tableB WHERE tableB.id_fromTabA=id AND prop_type=1), SELCET SELECT tableB.pro_string FROM tableB WHERE tableB.id_fromTabA=id AND prop_type=2)
FROM TableA
WHERE id=1
Plese tell me how to use
<join ../>
and construct same result but SQL to be with INNER JOIN
Thank you.