From 411382d4d925b083df7341f8076d7ab26dd4f70c Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Tue, 9 Dec 2008 00:17:23 +0000 Subject: [PATCH] OPENJPA-806: Refactor different domain paths into a single list in QueryDefinitionImpl. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@724564 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/criteria/TestCriteria.java | 31 +++++- .../query/AbstractDomainObject.java | 81 +++------------- .../persistence/query/AbstractPath.java | 23 ++++- .../persistence/query/AbstractVisitable.java | 4 - .../persistence/query/AliasContext.java | 8 +- .../persistence/query/ExpressionImpl.java | 7 -- .../openjpa/persistence/query/FetchPath.java | 27 +++--- .../openjpa/persistence/query/JoinPath.java | 16 ++-- .../persistence/query/NavigationPath.java | 10 ++ .../persistence/query/OperatorPath.java | 5 + .../persistence/query/QueryBuilderImpl.java | 5 - .../query/QueryDefinitionImpl.java | 96 ++++++++++++------- .../openjpa/persistence/query/RootPath.java | 4 + .../openjpa/persistence/query/Visitable.java | 17 ++-- 14 files changed, 182 insertions(+), 152 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java index 7fad2bcfa..1123fc57c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestCriteria.java @@ -118,7 +118,9 @@ public class TestCriteria extends SingleEMFTestCase { .where(photo.key().like("egret")); - String jpql = "select i.name, VALUE(p) from Item i join i.photos p where KEY(p) like 'egret'"; + String jpql = "select i.name, VALUE(p)" + + " from Item i join i.photos p" + + " where KEY(p) like 'egret'"; compare(jpql, qdef); } @@ -444,6 +446,33 @@ public class TestCriteria extends SingleEMFTestCase { compare(jpql, e); } + public void testCorrelatedSubquerySpecialCase1() { + DomainObject o = qb.createQueryDefinition(Order.class); + DomainObject a = qb.createSubqueryDefinition(o.get("customer").get("accounts")); + o.select(o) + .where(o.literal(10000).lessThan(a.select(a.get("balance")).all())); + + String jpql = "select o from Order o" + + " where 10000 < ALL " + + " (select a.balance from o.customer c join o.customer.accounts a)"; + + compare(jpql, o); + } + + public void testCorrelatedSubquerySpecialCase2() { + DomainObject o = qb.createQueryDefinition(Order.class); + DomainObject c = o.join("customer"); + DomainObject a = qb.createSubqueryDefinition(c.get("accounts")); + o.select(o) + .where(o.literal(10000).lessThan(a.select(a.get("balance")).all())); + + String jpql = "select o from Order o JOIN o.customer c" + + " where 10000 < ALL " + + " (select a.balance from c.accounts a)"; + + compare(jpql, o); + } + public void testRecursiveDefinitionIsNotAllowed() { DomainObject q = qb.createQueryDefinition(Customer.class); q.where(q.exists().and(q.get("name").equal("wrong"))); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java index 99af31268..b68d54a01 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractDomainObject.java @@ -18,7 +18,6 @@ */ package org.apache.openjpa.persistence.query; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; @@ -43,38 +42,12 @@ import javax.persistence.Subquery; */ public abstract class AbstractDomainObject extends AbstractPath implements DomainObject { - private final QueryDefinitionImpl _owner; - private List _joins; - private List _fetchJoins; protected AbstractDomainObject(QueryDefinitionImpl owner, AbstractPath parent, PathOperator op, Object part2) { - super(parent, op, part2); - _owner = owner; + super(owner, parent, op, part2); } - /** - * Gets the QueryDefinition that created this path. - * @return - */ - public QueryDefinitionImpl getOwner() { - return _owner; - } - - /** - * Gets the fetch joins associated with this path. Can be null. - */ - public List getFetchJoins() { - return _fetchJoins; - } - - /** - * Gets the joins associated with this path. Can be null. - */ - public List getJoins() { - return _joins; - } - /** * Adding a root adds a root domain to the owning query. */ @@ -100,49 +73,32 @@ public abstract class AbstractDomainObject extends AbstractPath * Derives a path from this path by joining the given field. * Also the joined path becomes a domain of the owning query. */ - public DomainObject join(String attribute) { - return join(attribute, PathOperator.INNER); + public DomainObject join(String attr) { + return _owner.addDomain(new JoinPath(this, PathOperator.INNER, attr)); } /** * Derives a path from this path by outer joining the given field. * Also the joined path becomes a domain of the owning query. */ - public DomainObject leftJoin(String attribute) { - return join(attribute, PathOperator.OUTER); - } - - protected DomainObject join(String attr, PathOperator joinType) { - JoinPath join = new JoinPath(this, joinType, attr); - if (_joins == null) { - _joins = new ArrayList(); - } - _joins.add(join); - return join; + public DomainObject leftJoin(String attr) { + return _owner.addDomain(new JoinPath(this, PathOperator.OUTER, attr)); } /** * Derives a path from this path by fetch joining the given field. */ - public FetchJoinObject joinFetch(String attribute) { - return fetchJoin(attribute, PathOperator.FETCH_INNER); + public FetchJoinObject joinFetch(String attr) { + return _owner.addDomain(new FetchPath(this, PathOperator.FETCH_INNER, + attr)); } /** * Derives a path from this path by fetch joining the given field. */ - public FetchJoinObject leftJoinFetch(String attribute) { - return fetchJoin(attribute, PathOperator.FETCH_OUTER); - } - - private FetchJoinObject fetchJoin(String attr, PathOperator joinType) { - NavigationPath path = new NavigationPath(_owner, this, attr); - FetchPath join = new FetchPath(path, joinType); - if (_fetchJoins == null) { - _fetchJoins = new ArrayList(); - } - _fetchJoins.add(join); - return join; + public FetchJoinObject leftJoinFetch(String attr) { + return _owner.addDomain(new FetchPath(this, PathOperator.FETCH_OUTER, + attr)); } /** @@ -376,19 +332,4 @@ public abstract class AbstractDomainObject extends AbstractPath public QueryDefinition where(Predicate predicate) { return _owner.where(predicate); } - - // ----------------------------------------------------------------------- - // contract for conversion to JPQL. - // ----------------------------------------------------------------------- - /** - * Sets alias for this domain and all its joins. - */ - public void setAlias(AliasContext ctx) { - ctx.getAlias(this); - if (_joins != null) - for (JoinPath join : _joins) - join.setAlias(ctx); - } - - } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java index 578c601aa..51760374d 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractPath.java @@ -18,6 +18,8 @@ */ package org.apache.openjpa.persistence.query; +import java.util.LinkedList; + import javax.persistence.Aggregate; import javax.persistence.Expression; import javax.persistence.PathExpression; @@ -45,8 +47,10 @@ abstract class AbstractPath extends ExpressionImpl implements protected final AbstractPath _parent; protected final Object _part2; protected final PathOperator _operator; + protected final QueryDefinitionImpl _owner; - protected AbstractPath(AbstractPath parent, PathOperator op, Object part2) { + protected AbstractPath(QueryDefinitionImpl owner, AbstractPath parent, PathOperator op, Object part2) { + _owner = owner; _parent = parent; _part2 = part2; _operator = op; @@ -55,6 +59,10 @@ abstract class AbstractPath extends ExpressionImpl implements // ------------------------------------------------------------------------ // Path related functions. // ------------------------------------------------------------------------ + + final QueryDefinitionImpl getOwner() { + return _owner; + } /** * Gets the parent from which this receiver has been derived. Can be null * for a root path. @@ -112,4 +120,17 @@ abstract class AbstractPath extends ExpressionImpl implements public Expression type() { return new TypeExpression(this); } + + LinkedList split() { + return _split(this, new LinkedList()); + } + + private LinkedList _split(AbstractPath path, + LinkedList list) { + if (path == null) + return list; + _split(path.getParent(), list); + list.add(path); + return list; + } } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractVisitable.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractVisitable.java index 09337bbd3..460cbcd14 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractVisitable.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AbstractVisitable.java @@ -39,10 +39,6 @@ abstract class AbstractVisitable implements Visitable { throw new UnsupportedOperationException(this.getClass().getName()); } - public void setAlias(AliasContext ctx) { - throw new UnsupportedOperationException(this.getClass().getName()); - } - public String asJoinable(AliasContext ctx) { throw new UnsupportedOperationException(this.getClass().getName()); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java index 5ef2bd392..6d743ecda 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/AliasContext.java @@ -49,7 +49,13 @@ class AliasContext { String alias = _aliases.get(path); if (alias != null) return alias; - alias = path.getAliasHint(this).substring(0,1).toLowerCase(); + return setAlias(path); + } + + public String setAlias(ExpressionImpl path) { + if (_aliases.containsKey(path)) + return _aliases.get(path); + String alias = path.getAliasHint(this).substring(0,1).toLowerCase(); int i = 2; while (_aliases.containsValue(alias)) { alias = alias.substring(0,1) + i; diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExpressionImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExpressionImpl.java index 0db362880..4b3bb58ac 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExpressionImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/ExpressionImpl.java @@ -462,14 +462,7 @@ abstract class ExpressionImpl extends AbstractVisitable // // Visitable/Selectable implementation // - public void setAlias(AliasContext ctx) { - ctx.getAlias(this); - } - public String getAliasHint(AliasContext ctx) { return "o"; } - - public abstract String asExpression(AliasContext ctx); - public abstract String asProjection(AliasContext ctx); } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/FetchPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/FetchPath.java index fe64f93c0..8c0caf0b6 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/FetchPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/FetchPath.java @@ -18,6 +18,8 @@ */ package org.apache.openjpa.persistence.query; +import static org.apache.openjpa.persistence.query.PathOperator.NAVIGATION; + import javax.persistence.FetchJoinObject; /** @@ -26,18 +28,21 @@ import javax.persistence.FetchJoinObject; * @author Pinaki Poddar * */ -public class FetchPath extends AbstractVisitable +public class FetchPath extends AbstractDomainObject implements FetchJoinObject, Visitable { - private NavigationPath _path; - private PathOperator _joinType; + FetchPath(AbstractDomainObject parent, PathOperator joinType, String attr) { + super(parent.getOwner(), parent, joinType, attr); + } + @Override + public String asJoinable(AliasContext ctx) { + StringBuffer tmp = new StringBuffer(getOperator().toString()); + tmp.append(getParent().asProjection(ctx)) + .append(NAVIGATION) + .append(getLastSegment()) + .append(" "); + + return tmp.toString(); + } - FetchPath(NavigationPath path, PathOperator joinType) { - _path = path; - _joinType = joinType; - } - - public String asExpression(AliasContext ctx) { - return _joinType + " " + _path.asExpression(ctx); - } } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JoinPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JoinPath.java index bcfda146c..9d494b4e6 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JoinPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/JoinPath.java @@ -49,17 +49,12 @@ public class JoinPath extends AbstractDomainObject implements DomainObject { @Override public String asJoinable(AliasContext ctx) { - StringBuffer tmp = new StringBuffer(getOperator().toString()); - tmp.append(getParent().asProjection(ctx)) + return new StringBuffer(getOperator().toString()) + .append(getParent().asProjection(ctx)) .append(NAVIGATION) .append(getLastSegment()) .append(" ") - .append(ctx.getAlias(this)); - - if (getJoins() != null) - for (JoinPath join : getJoins()) - tmp.append(join.asJoinable(ctx)); - return tmp.toString(); + .append(ctx.getAlias(this)).toString(); } @Override @@ -75,4 +70,9 @@ public class JoinPath extends AbstractDomainObject implements DomainObject { return ctx.getAlias(this); return getParent().asProjection(ctx) + NAVIGATION + getLastSegment(); } + + public String toString() { + return getOperator() + getParent().toString() + "*" + getLastSegment(); + } + } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NavigationPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NavigationPath.java index 9c5cfdc0e..20cefc558 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NavigationPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/NavigationPath.java @@ -37,6 +37,11 @@ class NavigationPath extends AbstractDomainObject implements PathExpression { return (String)super.getLastSegment(); } + @Override + public String getAliasHint(AliasContext ctx) { + return getLastSegment(); + } + @Override public String asProjection(AliasContext ctx) { AbstractPath parent = getParent(); @@ -59,4 +64,9 @@ class NavigationPath extends AbstractDomainObject implements PathExpression { public String asJoinable(AliasContext ctx) { return asProjection(ctx) + " " + ctx.getAlias(this); } + + public String toString() { + return getParent().toString()+"."+getLastSegment(); + } + } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OperatorPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OperatorPath.java index f7bf174f6..1ed98dd2c 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OperatorPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/OperatorPath.java @@ -55,4 +55,9 @@ public class OperatorPath extends AbstractDomainObject { public String asJoinable(AliasContext ctx) { throw new UnsupportedOperationException(); } + + public String toString() { + return getOperator() + "(" + getParent().toString() + ")"; + } + } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryBuilderImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryBuilderImpl.java index d6a9dcc7f..fddb3469b 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryBuilderImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryBuilderImpl.java @@ -18,17 +18,12 @@ */ package org.apache.openjpa.persistence.query; -import java.io.Serializable; - import javax.persistence.DomainObject; import javax.persistence.PathExpression; import javax.persistence.QueryBuilder; import javax.persistence.QueryDefinition; -import org.apache.openjpa.meta.ClassMetaData; import org.apache.openjpa.meta.MetaDataRepository; -import org.apache.openjpa.persistence.EntityManagerFactoryImpl; -import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory; import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI; /** diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java index e191d4ddc..f21d10e9f 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/QueryDefinitionImpl.java @@ -23,7 +23,10 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; import java.util.Date; +import java.util.LinkedList; import java.util.List; import javax.persistence.CaseExpression; @@ -79,16 +82,34 @@ public class QueryDefinitionImpl extends ExpressionImpl public DomainObject addSubqueryRoot(PathExpression path) { AbstractPath impl = (AbstractPath)path; - AbstractDomainObject newRoot = new NavigationPath(this, - impl.getParent(), impl.getLastSegment().toString()); - addDomain(newRoot); + LinkedList paths = impl.split(); + QueryDefinitionImpl owner = impl.getOwner(); + int i = 0; + while (i < paths.size() && owner.hasDomain(paths.get(i))) { + i++; + } + + AbstractPath next = paths.get(i); + DomainObject newRoot = new NavigationPath(this, + next.getParent(), next.getLastSegment().toString()); + addDomain((AbstractDomainObject)newRoot); + i++; + for (; i < paths.size(); i++) { + next = paths.get(i); + newRoot = newRoot.join(next.getLastSegment().toString()); + } return newRoot; } - protected void addDomain(AbstractDomainObject path) { + boolean hasDomain(PathExpression path) { + return _domains != null && _domains.contains(path); + } + + protected T addDomain(T path) { if (_domains == null) _domains = new ArrayList(); _domains.add(path); + return path; } public Subquery all() { @@ -138,6 +159,8 @@ public class QueryDefinitionImpl extends ExpressionImpl public QueryDefinition groupBy(PathExpression... pathExprs) { if (_groupBys == null) { _groupBys = new ArrayList(); + } else { + _groupBys.clear(); } for (PathExpression e : pathExprs) _groupBys.add(e); @@ -147,6 +170,8 @@ public class QueryDefinitionImpl extends ExpressionImpl public QueryDefinition groupBy(List pathExprList) { if (_groupBys == null) { _groupBys = new ArrayList(); + } else { + _groupBys.clear(); } for (PathExpression e : pathExprList) _groupBys.add(e); @@ -336,38 +361,17 @@ public class QueryDefinitionImpl extends ExpressionImpl return _projections; } - /** - * - */ @Override public String asExpression(AliasContext ctx) { ctx.push(this); StringBuffer buffer = new StringBuffer(); registerDomains(ctx); - - fillBuffer(_distinct ? "SELECT DISTINCT " : "SELECT ", buffer, ctx, - getProjections(), Visit.PROJECTION); - buffer.append(" FROM "); - for (int i=0; _domains != null && i < _domains.size(); i++) { - buffer.append(_domains.get(i).asJoinable(ctx)); - fillBuffer(" ", buffer, ctx, _domains.get(i).getJoins(), - Visit.JOINABLE); - fillBuffer(" ", buffer, ctx, _domains.get(i).getFetchJoins(), - Visit.EXPRESSION); - if (i != _domains.size()-1) - buffer.append(","); - } - if (_where != null) { - buffer.append(" WHERE ") - .append(((Visitable)_where).asExpression(ctx)); - } - + String select = _distinct ? "SELECT DISTINCT " : "SELECT "; + fillBuffer(select, buffer, ctx, getProjections(), Visit.PROJECTION); + fillBuffer(" FROM ", buffer, ctx, _domains, Visit.JOINABLE); + fillBuffer(" WHERE ", buffer, ctx, _where); fillBuffer(" GROUP BY ", buffer, ctx, _groupBys, Visit.EXPRESSION); - - if (_having != null) { - buffer.append(" HAVING ") - .append(((Visitable)_having).asExpression(ctx)); - } + fillBuffer(" HAVING ", buffer, ctx, _having); fillBuffer(" ORDER BY ", buffer, ctx, _orderBys, Visit.EXPRESSION); return buffer.toString(); @@ -391,28 +395,50 @@ public class QueryDefinitionImpl extends ExpressionImpl case EXPRESSION : buffer.append(v.asExpression(ctx)) .append(i != list.size()-1 ? ", " : " "); break; - case JOINABLE : buffer.append(v.asJoinable(ctx)); + case JOINABLE : buffer.append(v.asJoinable(ctx)) + .append(i > 0 && v instanceof RootPath ? + "," : " "); break; } } } + public void fillBuffer(String header, StringBuffer buffer, AliasContext ctx, + Predicate p) { + if (p == null) + return; + Visitable v = (Visitable)p; + buffer.append(header); + buffer.append(v.asExpression(ctx)); + } + /** - * Registers each domain with an alias. - * @param ctx + * Registers each domain with an alias. Also set alias for order by items + * that are projected. */ private void registerDomains(AliasContext ctx) { if (_domains != null) { + Collections.sort(_domains, new DomainSorter()); for (AbstractDomainObject domain : _domains) { - domain.setAlias(ctx); + ctx.setAlias(domain); } } if (_orderBys != null) { for (OrderableItem o : _orderBys) { ExpressionImpl e = o.getExpression(); if (_projections != null && _projections.contains(e)) - e.setAlias(ctx); + ctx.setAlias(e); } } } + + static class DomainSorter implements Comparator { + static List _order = Arrays.asList(new Class[] { + RootPath.class, NavigationPath.class, OperatorPath.class, + JoinPath.class, FetchPath.class, } ); + + public int compare(AbstractDomainObject a, AbstractDomainObject b) { + return _order.indexOf(a.getClass()) - _order.indexOf(b.getClass()); + } + } } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RootPath.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RootPath.java index a9867c776..b508e0d7c 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RootPath.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/RootPath.java @@ -38,4 +38,8 @@ public class RootPath extends AbstractDomainObject implements DomainObject { public String asProjection(AliasContext ctx) { return ctx.getAlias(this); } + + public String toString() { + return getLastSegment().getSimpleName(); + } } diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Visitable.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Visitable.java index 0f7a098b5..5de86acad 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Visitable.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/query/Visitable.java @@ -29,24 +29,23 @@ import java.io.Serializable; */ public interface Visitable extends Serializable { /** - * Get a JPQL fragment as used in a WHERE clause. + * Get a JPQL fragment as used in WHERE clause. */ String asExpression(AliasContext ctx); /** - * Gets the string representation in a SELECT projection. + * Gets the string representation in SELECT projection. */ String asProjection(AliasContext ctx); /** - * Sets alias. + * Gets the string representation in FROM clause. */ - void setAlias(AliasContext ctx); - - String getAliasHint(AliasContext ctx); - String asJoinable(AliasContext ctx); - - + + /** + * Gets the hint to be used while creating alias. + */ + String getAliasHint(AliasContext ctx); }