Description of problem: When joining two objects with an association where the retrieve operator is used and the association contains an object with more than one column as key then OQL joins the tables using: table1 join table2 on (table2.column1, table2.column2) in ([static retrieve]) An example of this is the association between Party and PartyEmail SQL server does not support this kind of in expression. I suggest using: table1 join table2 on exists (select column1, column2 from ([static retrieve]) _temp where _temp.column1 = table2.column1 and _temp.column2 = table2.column2) You can do this by modifying com.redhat.persistence.oql.Get.PropertyCondition.emitStatic(); replace lines 250-259 with: in.append("exists (select "); for (int i = 0; i < cols.length; i++) { in.append(cols[i]); if (i < cols.length - 1) { in.append(", "); } } in.append(" from ("); in(m.getRetrieve().getSQL(), cols, bindings, in); in.append(") _temp "); in.append("where "); for (int i = 0; i < cols.length; i++) { in.append("_temp." + cols[i] + " = " + to[i]); if (i < to.length - 1) { in.append(" and "); } } in.append(")");
We'll have to parameterize this on db. I used to have it the way you describe, but oracle has problems with that version. Not sure which version makes a better default.