Bug 124679 - OQL compatibility with MS SQL Server
OQL compatibility with MS SQL Server
Status: CLOSED WONTFIX
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence (Show other bugs)
nightly
All Linux
medium Severity medium
: ---
: ---
Assigned To: Rafael H. Schloming
Jon Orris
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-28 09:58 EDT by Brett Prucha
Modified: 2014-12-01 18:13 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-28 17:37:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Brett Prucha 2004-05-28 09:58:55 EDT
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(")");
Comment 1 Rafael H. Schloming 2004-05-28 11:09:05 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.