com.mysema.query.sql
Class AbstractSQLQuery<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query>

java.lang.Object
  extended by com.mysema.query.support.QueryBase<Q>
      extended by com.mysema.query.support.ProjectableQuery<Q>
          extended by com.mysema.query.sql.AbstractSQLQuery<Q>
All Implemented Interfaces:
com.mysema.query.Projectable
Direct Known Subclasses:
MySQLQuery, OracleQuery, PostgresQuery, SQLQueryImpl, SQLServerQuery

public abstract class AbstractSQLQuery<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query>
extends com.mysema.query.support.ProjectableQuery<Q>

AbstractSQLQuery is the base type for SQL query implementations

Author:
tiwe

Field Summary
protected  SQLQueryMixin<Q> queryMixin
           
protected  com.mysema.query.types.SubQueryExpression<?>[] union
           
protected  boolean unionAll
           
 
Constructor Summary
AbstractSQLQuery(Connection conn, Configuration configuration)
           
AbstractSQLQuery(Connection conn, Configuration configuration, com.mysema.query.QueryMetadata metadata)
           
 
Method Summary
 Q addFlag(com.mysema.query.QueryFlag.Position position, com.mysema.query.types.Expression<?> flag)
          Add the given Expression as a query flag
 Q addFlag(com.mysema.query.QueryFlag.Position position, String flag)
          Add the given String literal as query flag
 Q addFlag(com.mysema.query.QueryFlag.Position position, String prefix, com.mysema.query.types.Expression<?> expr)
          Add the given prefix and expression as a general query flag
 Q addJoinFlag(String flag)
          Add the given String literal as a join flag to the last added join with the position BEFORE_TARGET
 Q addJoinFlag(String flag, com.mysema.query.JoinFlag.Position position)
          Add the given String literal as a join flag to the last added join
protected  String buildQueryString(boolean forCountRow)
           
 long count()
           
protected  SQLSerializer createSerializer()
           
 boolean exists()
           
 Q forUpdate()
           
 Q from(com.mysema.query.types.Expression<?>... args)
           
 Q from(com.mysema.query.types.SubQueryExpression<?> subQuery, com.mysema.query.types.Path<?> alias)
           
<E> Q
fullJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
<E> Q
fullJoin(RelationalFunctionCall<E> target, com.mysema.query.types.Path<E> alias)
           
 Q fullJoin(RelationalPath<?> target)
           
 Q fullJoin(com.mysema.query.types.SubQueryExpression<?> target, com.mysema.query.types.Path<?> alias)
           
protected  Configuration getConfiguration()
           
 com.mysema.query.QueryMetadata getMetadata()
           
 ResultSet getResults(com.mysema.query.types.Expression<?>... exprs)
           
<E> Q
innerJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
<E> Q
innerJoin(RelationalFunctionCall<E> target, com.mysema.query.types.Path<E> alias)
           
 Q innerJoin(RelationalPath<?> target)
           
 Q innerJoin(com.mysema.query.types.SubQueryExpression<?> target, com.mysema.query.types.Path<?> alias)
           
 com.mysema.commons.lang.CloseableIterator<Object[]> iterate(com.mysema.query.types.Expression<?>[] args)
           
<RT> com.mysema.commons.lang.CloseableIterator<RT>
iterate(com.mysema.query.types.Expression<RT> expr)
           
<E> Q
join(ForeignKey<E> key, RelationalPath<E> entity)
           
<E> Q
join(RelationalFunctionCall<E> target, com.mysema.query.types.Path<E> alias)
           
 Q join(RelationalPath<?> target)
           
 Q join(com.mysema.query.types.SubQueryExpression<?> target, com.mysema.query.types.Path<?> alias)
           
<E> Q
leftJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
<E> Q
leftJoin(RelationalFunctionCall<E> target, com.mysema.query.types.Path<E> alias)
           
 Q leftJoin(RelationalPath<?> target)
           
 Q leftJoin(com.mysema.query.types.SubQueryExpression<?> target, com.mysema.query.types.Path<?> alias)
           
 List<Object[]> list(com.mysema.query.types.Expression<?>[] args)
           
<RT> List<RT>
list(com.mysema.query.types.Expression<RT> expr)
           
<RT> com.mysema.query.SearchResults<RT>
listResults(com.mysema.query.types.Expression<RT> expr)
           
 Q on(com.mysema.query.types.Predicate... conditions)
           
<E> Q
rightJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
<E> Q
rightJoin(RelationalFunctionCall<E> target, com.mysema.query.types.Path<E> alias)
           
 Q rightJoin(RelationalPath<?> target)
           
 Q rightJoin(com.mysema.query.types.SubQueryExpression<?> target, com.mysema.query.types.Path<?> alias)
           
protected  void setParameters(PreparedStatement stmt, List<?> objects, List<com.mysema.query.types.Path<?>> constantPaths, Map<com.mysema.query.types.ParamExpression<?>,?> params)
           
 String toString()
           
<RT> Union<RT>
union(com.mysema.query.types.query.ListSubQuery<RT>... sq)
           
<RT> Q
union(com.mysema.query.types.Path<?> alias, com.mysema.query.types.query.ListSubQuery<RT>... sq)
           
<RT> Q
union(com.mysema.query.types.Path<?> alias, com.mysema.query.types.SubQueryExpression<RT>... sq)
           
<RT> Union<RT>
union(com.mysema.query.types.SubQueryExpression<RT>... sq)
           
<RT> Union<RT>
unionAll(com.mysema.query.types.query.ListSubQuery<RT>... sq)
           
<RT> Q
unionAll(com.mysema.query.types.Path<?> alias, com.mysema.query.types.query.ListSubQuery<RT>... sq)
           
<RT> Q
unionAll(com.mysema.query.types.Path<?> alias, com.mysema.query.types.SubQueryExpression<RT>... sq)
           
<RT> Union<RT>
unionAll(com.mysema.query.types.SubQueryExpression<RT>... sq)
           
 Object[] uniqueResult(com.mysema.query.types.Expression<?>[] expr)
           
<RT> RT
uniqueResult(com.mysema.query.types.Expression<RT> expr)
           
 
Methods inherited from class com.mysema.query.support.ProjectableQuery
countDistinct, iterate, iterateDistinct, iterateDistinct, iterateDistinct, list, listDistinct, listDistinct, listDistinct, listDistinctResults, map, notExists, singleResult, singleResult, singleResult, transform, uniqueResult, uniqueResult
 
Methods inherited from class com.mysema.query.support.QueryBase
distinct, equals, groupBy, hashCode, having, limit, offset, orderBy, restrict, set, where
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

union

@Nullable
protected com.mysema.query.types.SubQueryExpression<?>[] union

queryMixin

protected final SQLQueryMixin<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query> queryMixin

unionAll

protected boolean unionAll
Constructor Detail

AbstractSQLQuery

public AbstractSQLQuery(@Nullable
                        Connection conn,
                        Configuration configuration)

AbstractSQLQuery

public AbstractSQLQuery(@Nullable
                        Connection conn,
                        Configuration configuration,
                        com.mysema.query.QueryMetadata metadata)
Method Detail

addJoinFlag

public Q addJoinFlag(String flag)
Add the given String literal as a join flag to the last added join with the position BEFORE_TARGET

Parameters:
flag -
Returns:

addJoinFlag

public Q addJoinFlag(String flag,
                     com.mysema.query.JoinFlag.Position position)
Add the given String literal as a join flag to the last added join

Parameters:
flag -
position -
Returns:

addFlag

public Q addFlag(com.mysema.query.QueryFlag.Position position,
                 String prefix,
                 com.mysema.query.types.Expression<?> expr)
Add the given prefix and expression as a general query flag

Parameters:
position - position of the flag
prefix - prefix for the flag
expr - expression of the flag
Returns:

addFlag

public Q addFlag(com.mysema.query.QueryFlag.Position position,
                 String flag)
Add the given String literal as query flag

Parameters:
position -
flag -
Returns:

addFlag

public Q addFlag(com.mysema.query.QueryFlag.Position position,
                 com.mysema.query.types.Expression<?> flag)
Add the given Expression as a query flag

Parameters:
position -
flag -
Returns:

buildQueryString

protected String buildQueryString(boolean forCountRow)

count

public long count()

exists

public boolean exists()

forUpdate

public Q forUpdate()

createSerializer

protected SQLSerializer createSerializer()

from

public Q from(com.mysema.query.types.Expression<?>... args)

from

public Q from(com.mysema.query.types.SubQueryExpression<?> subQuery,
              com.mysema.query.types.Path<?> alias)

fullJoin

public Q fullJoin(RelationalPath<?> target)

fullJoin

public <E> Q fullJoin(RelationalFunctionCall<E> target,
                      com.mysema.query.types.Path<E> alias)

fullJoin

public Q fullJoin(com.mysema.query.types.SubQueryExpression<?> target,
                  com.mysema.query.types.Path<?> alias)

fullJoin

public <E> Q fullJoin(ForeignKey<E> key,
                      RelationalPath<E> entity)

innerJoin

public Q innerJoin(RelationalPath<?> target)

innerJoin

public <E> Q innerJoin(RelationalFunctionCall<E> target,
                       com.mysema.query.types.Path<E> alias)

innerJoin

public Q innerJoin(com.mysema.query.types.SubQueryExpression<?> target,
                   com.mysema.query.types.Path<?> alias)

innerJoin

public <E> Q innerJoin(ForeignKey<E> key,
                       RelationalPath<E> entity)

join

public Q join(RelationalPath<?> target)

join

public <E> Q join(RelationalFunctionCall<E> target,
                  com.mysema.query.types.Path<E> alias)

join

public Q join(com.mysema.query.types.SubQueryExpression<?> target,
              com.mysema.query.types.Path<?> alias)

join

public <E> Q join(ForeignKey<E> key,
                  RelationalPath<E> entity)

leftJoin

public Q leftJoin(RelationalPath<?> target)

leftJoin

public <E> Q leftJoin(RelationalFunctionCall<E> target,
                      com.mysema.query.types.Path<E> alias)

leftJoin

public Q leftJoin(com.mysema.query.types.SubQueryExpression<?> target,
                  com.mysema.query.types.Path<?> alias)

leftJoin

public <E> Q leftJoin(ForeignKey<E> key,
                      RelationalPath<E> entity)

rightJoin

public Q rightJoin(RelationalPath<?> target)

rightJoin

public <E> Q rightJoin(RelationalFunctionCall<E> target,
                       com.mysema.query.types.Path<E> alias)

rightJoin

public Q rightJoin(com.mysema.query.types.SubQueryExpression<?> target,
                   com.mysema.query.types.Path<?> alias)

rightJoin

public <E> Q rightJoin(ForeignKey<E> key,
                       RelationalPath<E> entity)

getMetadata

public com.mysema.query.QueryMetadata getMetadata()

getResults

public ResultSet getResults(com.mysema.query.types.Expression<?>... exprs)

getConfiguration

protected Configuration getConfiguration()

iterate

public com.mysema.commons.lang.CloseableIterator<Object[]> iterate(com.mysema.query.types.Expression<?>[] args)

iterate

public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate(com.mysema.query.types.Expression<RT> expr)

list

public List<Object[]> list(com.mysema.query.types.Expression<?>[] args)
Specified by:
list in interface com.mysema.query.Projectable
Overrides:
list in class com.mysema.query.support.ProjectableQuery<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query>

list

public <RT> List<RT> list(com.mysema.query.types.Expression<RT> expr)
Specified by:
list in interface com.mysema.query.Projectable
Overrides:
list in class com.mysema.query.support.ProjectableQuery<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query>

listResults

public <RT> com.mysema.query.SearchResults<RT> listResults(com.mysema.query.types.Expression<RT> expr)

on

public Q on(com.mysema.query.types.Predicate... conditions)

setParameters

protected void setParameters(PreparedStatement stmt,
                             List<?> objects,
                             List<com.mysema.query.types.Path<?>> constantPaths,
                             Map<com.mysema.query.types.ParamExpression<?>,?> params)

toString

public String toString()
Overrides:
toString in class com.mysema.query.support.QueryBase<Q extends AbstractSQLQuery<Q> & com.mysema.query.Query>

union

public <RT> Union<RT> union(com.mysema.query.types.query.ListSubQuery<RT>... sq)

union

public <RT> Q union(com.mysema.query.types.Path<?> alias,
                    com.mysema.query.types.query.ListSubQuery<RT>... sq)

union

public <RT> Union<RT> union(com.mysema.query.types.SubQueryExpression<RT>... sq)

union

public <RT> Q union(com.mysema.query.types.Path<?> alias,
                    com.mysema.query.types.SubQueryExpression<RT>... sq)

unionAll

public <RT> Union<RT> unionAll(com.mysema.query.types.query.ListSubQuery<RT>... sq)

unionAll

public <RT> Q unionAll(com.mysema.query.types.Path<?> alias,
                       com.mysema.query.types.query.ListSubQuery<RT>... sq)

unionAll

public <RT> Union<RT> unionAll(com.mysema.query.types.SubQueryExpression<RT>... sq)

unionAll

public <RT> Q unionAll(com.mysema.query.types.Path<?> alias,
                       com.mysema.query.types.SubQueryExpression<RT>... sq)

uniqueResult

public <RT> RT uniqueResult(com.mysema.query.types.Expression<RT> expr)

uniqueResult

public Object[] uniqueResult(com.mysema.query.types.Expression<?>[] expr)


Copyright © 2007-2012 Mysema Ltd. All Rights Reserved.