OPENJPA-681 Subquery generates SQL with syntax error

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@683876 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-08-08 06:46:29 +00:00
parent 4668ea4e77
commit 053ad36618
2 changed files with 6 additions and 2 deletions

View File

@ -618,8 +618,10 @@ public class SelectImpl
// if alias is defined and referenced, return true. // if alias is defined and referenced, return true.
String value = "t" + alias.toString() + "."; String value = "t" + alias.toString() + ".";
if (_tableAliases != null) if (_tableAliases != null)
return _tableAliases.containsValue(value) && if (_tableAliases.containsValue(value))
_tables.containsKey(alias); return _tables.containsKey(alias);
else
return _joins != null;
else else
return true; return true;
} }

View File

@ -66,6 +66,8 @@ public class TestSubquery
" and (select min(o2.amount) from Customer c, in(c.orders) o2)", " and (select min(o2.amount) from Customer c, in(c.orders) o2)",
"select o.oid from Customer c, in(c.orders)o where o.amount >" + "select o.oid from Customer c, in(c.orders)o where o.amount >" +
" (select sum(o2.amount) from c.orders o2)", " (select sum(o2.amount) from c.orders o2)",
"select o1.oid, c.name from Order o1, Customer c where o1.amount = " +
" any(select o2.amount from in(c.orders) o2)",
// outstanding problem subqueries: // outstanding problem subqueries:
//"select o from Order o where o.amount > (select count(o) from Order o)", //"select o from Order o where o.amount > (select count(o) from Order o)",
//"select o from Order o where o.amount > (select count(o2) from Order o2)", //"select o from Order o where o.amount > (select count(o2) from Order o2)",