Hello,
I have the following Object model:
Code:
public class MyFirstClass
{
private long id = -1;
private MySecondClass class2 = null;
private List<MySecondClass> class2List1 = null;
private List<MySecondClass> class2List2 = null;
private List<MySecondClass> class2List3 = null;
private String content = null;
private boolean property1 = true;
private boolean property2 = false;
private boolean property3 = false;
(....)
and
Code:
public class MySecondClass
{
private long id = -1;
private String name = null;
(....)
And the following tables model:
Code:
Table Table1
-------------
ID
TABLE2_ID
CONTENT
Code:
JOIN_TABLE_12
----------------
ID
TABLE1_ID
TABLE2_ID
TYPE
PROPERTY1
PROPERTY2
PROPERTY3
Code:
Table Table2
-------------
ID
NAME
In my mapping configuration for MyFirstClass, I know how to map simple fields, like id, class2 and content.
My mapping of MySecondClass is fine too.
I still cannot find how I can do the following:
1. Map each of the 3 list (class2List1, class2List2 and class2List3) using the field TYPE in the join table as a discriminant (so record with TYPE=1 will go in class2List1 and so on).
2. To map the 3 properties (property1, property2 and property3) to the corresponding fields in the join table.
If anybody could give me some help on that, and if possible some example, it would be greatly appreciated.
Thank you.
Regards,
<