| author: Matthew.Baird author: Illustrates a problem with OJB SQL Generation: author: 1. OJB will generate the following SQL when items are mapped to the same table: author: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID author: FROM FAMILY_MEMBER A0 author: INNER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID author: INNER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID author: WHERE A1.ID = ? OR (A2.ID = ? ) author: When it should generate: author: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID author: FROM FAMILY_MEMBER A0 author: WHERE A0.FATHER_ID = ? OR (A0.MOTHER_ID = ? ) author: or: author: SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID author: FROM FAMILY_MEMBER A0 author: LEFT OUTER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID author: LEFT OUTER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID author: WHERE A1.ID = ? OR (A2.ID = ?) |