Bug 124679 - OQL compatibility with MS SQL Server
Summary: OQL compatibility with MS SQL Server
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: persistence
Version: nightly
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Rafael H. Schloming
QA Contact: Jon Orris
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-05-28 13:58 UTC by Brett Prucha
Modified: 2014-12-01 23:13 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-09-28 21:37:42 UTC
Embargoed:


Attachments (Terms of Use)

Description Brett Prucha 2004-05-28 13:58:55 UTC
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 15:09:05 UTC
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.