Hi All,
I am using Hibernate 2.1, Middlegen 2.1 with Oracle 9i. I have 3 tables:
Table A with A_id as primary key
Table B with B_id as primary key
Table C with C_id as primary key
I also defined a cross reference table called Table D with all three primary keys as its composite key.
I defined a table D in Middlegen's Ant task as follows:
< table name="D" />
Id di not define many2many tag to define it as a link table as it is a link tables of 3 tables instead of two.
Can someone please let me know if it is correct ? How would you define a link table made up of 3 tables ?
In order to add a record table A, I am making a call as:
session.save(objA);
In order to make a reacord in a link table D, I am calling:
session.save(objB);
DPK dpk = new DPK(A_id, B_id, C_id);
D objD = new D(dpk);
session.save(objD);
Table C is a lookup table.
I am getting a problem while retrieving object A, it does not return all its associated table D records.
Your help will be greatly appreciated.
Thanks
Ron
|