You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Eigen Technology Pty Ltd <mi...@eigentechnology.com> on 2003/01/15 01:06:07 UTC

one-to-many Joins

There could have an answer to this question in the archive, I may not have
put in the right search string to find it. Would appreciate if anyone
could point me to one if he/she knows its existence.

My simple question on Join Table:

How do I join two or more tables with Foreign Key(s) pointing to a common
Table?

            Criteria criteria = new Criteria();
            criteria.addJoin(TABLE_B.Ref_A_ID, TABLE_A.ID);
            criteria.addJoin(TABLE_A.ID, TABLE_C.Ref_A_ID);
            return (TABLE_C.doSelect(criteria));

did not work.

e.g.  Table_B and Table_C have foreign-keys (Ref_A_ID) referencing to ID
in Table_A.

Table A
ID
Col_A1
Col_A2

Table B
ID
Ref_A_ID
Col_B1

Table C
ID
Ref_A_ID
Col_C1

Thanks
michael






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>