mirror of https://github.com/apache/openjpa.git
OPENJPA-1493: performance fix in getTableIndex
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@906614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ec0eeedf35
commit
814fef0f7d
|
@ -166,7 +166,9 @@ public class SelectConstructor
|
|||
subsel.setParent(sel, subquery.getCandidateAlias());
|
||||
}
|
||||
}
|
||||
|
||||
if (HasContainsExpressionVisitor.hasContains(exps.filter)) {
|
||||
sel.setHasSubselect(true);
|
||||
}
|
||||
initialize(sel, ctx, exps, state);
|
||||
|
||||
if (!sel.getAutoDistinct()) {
|
||||
|
|
|
@ -443,6 +443,14 @@ public class LogicalUnion
|
|||
throw new UnsupportedException(_loc.get("union-element"));
|
||||
}
|
||||
|
||||
public void setHasSubselect(boolean hasSub) {
|
||||
sel.setHasSubselect(hasSub);
|
||||
}
|
||||
|
||||
public boolean getHasSubselect() {
|
||||
return sel.getHasSubselect();
|
||||
}
|
||||
|
||||
public Select getFromSelect() {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -719,4 +719,18 @@ public interface Select
|
|||
* @param schemaAlias
|
||||
*/
|
||||
public void setSchemaAlias(String schemaAlias);
|
||||
|
||||
/**
|
||||
* Set the flag to indicate whether this Select has
|
||||
* internally generated subselect
|
||||
*/
|
||||
public void setHasSubselect(boolean hasSub);
|
||||
|
||||
/**
|
||||
* Return the flag to indicate whether this Select has
|
||||
* internally generated subselect
|
||||
* @return
|
||||
*/
|
||||
public boolean getHasSubselect();
|
||||
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@ public class SelectImpl
|
|||
private List _subsels = null;
|
||||
private SelectImpl _parent = null;
|
||||
private String _subPath = null;
|
||||
private boolean _hasSub = false;
|
||||
|
||||
// from select if this select selects from a tmp table created by another
|
||||
private SelectImpl _from = null;
|
||||
|
@ -559,6 +560,14 @@ public class SelectImpl
|
|||
}
|
||||
}
|
||||
|
||||
public void setHasSubselect(boolean hasSub) {
|
||||
_hasSub = hasSub;
|
||||
}
|
||||
|
||||
public boolean getHasSubselect() {
|
||||
return _hasSub;
|
||||
}
|
||||
|
||||
public Map getAliases() {
|
||||
return _aliases;
|
||||
}
|
||||
|
@ -1990,8 +1999,9 @@ public class SelectImpl
|
|||
if (pj != null && pj.path() != null)
|
||||
key = new Key(pj.path().toString(), key);
|
||||
|
||||
if (_ctx != null && (_parent != null || _subsels != null))
|
||||
if (_ctx != null && (_parent != null || _subsels != null || _hasSub)) {
|
||||
i = findAliasForQuery(table, pj, key, create);
|
||||
}
|
||||
|
||||
if (i != null)
|
||||
return i.intValue();
|
||||
|
|
|
@ -1161,7 +1161,6 @@ public class TestTypesafeCriteria extends CriteriaTest {
|
|||
executeAndCompareSQL(q, sql);
|
||||
}
|
||||
|
||||
@AllowFailure(message="The expected sql string is incorrect")
|
||||
public void testValues5() {
|
||||
String sql = "SELECT t0.name, t2.id, t2.label FROM CR_ITEM t0 "
|
||||
+ "INNER JOIN CR_ITEM_photos t1 ON t0.id = t1.ITEM_ID "
|
||||
|
|
Loading…
Reference in New Issue