DataNucleus - Products
  History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RDBMS-76
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JPOX RDBMS

JDOQL : contains query has duplicated WHERE clause entries

Created: 02/Jan/08 11:45 AM   Updated: 02/Jan/08 05:09 PM
Component/s: Queries
Affects Version/s: None
Fix Version/s: 1.2.0-rc-1


 Description  « Hide
The JDOQL
SELECT this.id FROM org.jpox.test.A
WHERE this.setB.contains(b1) && b1.propertyName == :propName1 && b1.value == :propValue1
VARIABLES org.jpox.test.B b1

results in SQL of

SELECT `THIS`.`ID`
FROM `A` `THIS` CROSS JOIN `B` `UNBOUND_B1`
WHERE EXISTS (
    SELECT 1 FROM `B` `THIS_SETB_B1`
    WHERE `THIS_SETB_B1`.`A_ID` = `THIS`.`ID`
    AND `THIS_SETB_B1`.`A_ID` = `THIS`.`ID`
    AND `UNBOUND_B1`.`ID` = `THIS_SETB_B1`.`ID`
    AND `THIS_SETB_B1`.`PROPERTY_NAME` = 'EditorialItemTitle'
    AND `THIS_SETB_B1`.`VALUE` = 'Plan the Perfect Alaskan Vacation')

so the EXISTS subselect has THIS_SETB_B1.A_ID = THIS.ID duplicated. This comes out of CollectionExpression.contains

QueryExpression qexpr = collStore.getExistsSubquery(qs, mapping, te, ctRangeVar);
...
ScalarExpression bindTo = collStore.joinElementsTo(qexpr, qs, mapping, te, ctRangeVar, var.getVariableType(), expr, expr.te == null ? etRangeVar : expr.te.getRangeVariable());

and each of these parts is adding the constraint. Why ?

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson - 02/Jan/08 05:09 PM
SVN trunk now eliminates the dup'd WHERE clause on EXISTS