andQualifier applied to wrong table
-----------------------------------
Key: CAY-727
URL: https://issues.apache.org/cayenne/browse/CAY-727
Project: Cayenne
Issue Type: Bug
Components: Cayenne Core Library
Affects Versions: 1.2 [STABLE]
Reporter: Robert Wruck
I have the following code:
SelectQuery q = new SelectQuery(MyObject.class)
q.andQualifier(ExpressionFactory.matchExp("rel1.att1", "someValue"));
q.andQualifier(ExpressionFactory.matchExp("rel1", someObject));
List l = dc.performQuery(q);
(Of course this is kind of redundant, but in reality, the second expression is generated when the user chooses some criteria and the first is always present).
Now the generated SQL looks like this:
SELECT t0.column1, t0.column2 FROM myobject t0, relobject t1 WHERE t0.rel1 = t1.id AND ((t1.att1 = someValue) AND (t1.rel1 = 42))
The last condition is wrong, because the column rel1 is in table t0, not t1. The correct statement would be:
SELECT t0.column1, t0.column2 FROM myobject t0, relobject t1 WHERE t0.rel1 = t1.id AND ((t1.att1 = someValue) AND (t0.rel1 = 42))
This does not happen if I comment out the first qualifier (rel1.att1).
cayenne version is 1.2.1.
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/cayenne/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Fri Jan 05 2007 - 11:07:12 EST