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

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:
Projectable
Direct Known Subclasses:
MySQLQuery, OracleQuery, SQLQueryImpl, SQLServerQuery

public abstract class AbstractSQLQuery<Q extends AbstractSQLQuery<Q>>
extends ProjectableQuery<Q>

AbstractSQLQuery is the base type for SQL query implementations

Author:
tiwe

Nested Class Summary
 class AbstractSQLQuery.UnionBuilder<RT>
           
 
Field Summary
 
Fields inherited from class com.mysema.query.support.QueryBase
queryMixin
 
Constructor Summary
AbstractSQLQuery(Connection conn, Configuration configuration)
           
AbstractSQLQuery(Connection conn, Configuration configuration, QueryMetadata metadata)
           
 
Method Summary
 Q addFlag(QueryFlag.Position position, Expression<?> flag)
          Add the given Expression as a query flag
 Q addFlag(QueryFlag.Position position, String flag)
          Add the given String literal as query flag
 Q addFlag(QueryFlag.Position position, String prefix, 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, JoinFlag.Position position)
          Add the given String literal as a join flag to the last added join
protected  String buildQueryString(boolean forCountRow)
           
 long count()
          return the amount of matched rows
protected  SQLSerializer createSerializer()
           
 boolean exists()
           
 Q from(Expression<?>... args)
           
 Q from(SubQueryExpression<?> subQuery, Path<?> alias)
           
<E> Q
fullJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
 Q fullJoin(RelationalPath<?> target)
           
 Q fullJoin(SubQueryExpression<?> target, Path<?> alias)
           
protected  Configuration getConfiguration()
           
 QueryMetadata getMetadata()
           
 ResultSet getResults(Expression<?>... exprs)
           
<E> Q
innerJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
 Q innerJoin(RelationalPath<?> target)
           
 Q innerJoin(SubQueryExpression<?> target, Path<?> alias)
           
 com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?>[] args)
          iterate over the results for the given projection
<RT> com.mysema.commons.lang.CloseableIterator<RT>
iterate(Expression<RT> expr)
          iterate over the results for the given projection
<E> Q
join(ForeignKey<E> key, RelationalPath<E> entity)
           
 Q join(RelationalPath<?> target)
           
 Q join(SubQueryExpression<?> target, Path<?> alias)
           
<E> Q
leftJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
 Q leftJoin(RelationalPath<?> target)
           
 Q leftJoin(SubQueryExpression<?> target, Path<?> alias)
           
 List<Object[]> list(Expression<?>[] args)
          list the results for the given projection An empty list is returned for no results.
<RT> List<RT>
list(Expression<RT> expr)
          list the results for the given projection An empty list is returned for no results.
<RT> SearchResults<RT>
listResults(Expression<RT> expr)
          list the results for the given projection
 Q on(Predicate... conditions)
           
<E> Q
rightJoin(ForeignKey<E> key, RelationalPath<E> entity)
           
 Q rightJoin(RelationalPath<?> target)
           
 Q rightJoin(SubQueryExpression<?> target, Path<?> alias)
           
protected  void setParameters(PreparedStatement stmt, List<?> objects, List<Path<?>> constantPaths, Map<ParamExpression<?>,?> params)
           
 String toString()
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
union(ListSubQuery<RT>... sq)
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
union(SubQueryExpression<RT>... sq)
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
unionAll(ListSubQuery<RT>... sq)
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
unionAll(SubQueryExpression<RT>... sq)
           
 Object[] uniqueResult(Expression<?>[] expr)
          return a unique result for the given projection or null if no result is found
<RT> RT
uniqueResult(Expression<RT> expr)
          return a unique result for the given projection or null if no result is found
 
Methods inherited from class com.mysema.query.support.ProjectableQuery
countDistinct, iterate, iterateDistinct, iterateDistinct, iterateDistinct, list, listDistinct, listDistinct, listDistinct, listDistinctResults, map, notExists, singleResult, singleResult, singleResult, uniqueResult, uniqueResult
 
Methods inherited from class com.mysema.query.support.QueryBase
distinct, groupBy, having, limit, offset, orderBy, restrict, set, where
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractSQLQuery

public AbstractSQLQuery(@Nullable
                        Connection conn,
                        Configuration configuration)

AbstractSQLQuery

public AbstractSQLQuery(@Nullable
                        Connection conn,
                        Configuration configuration,
                        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,
                     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(QueryFlag.Position position,
                 String prefix,
                 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(QueryFlag.Position position,
                 String flag)
Add the given String literal as query flag

Parameters:
position -
flag -
Returns:

addFlag

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

Parameters:
position -
flag -
Returns:

buildQueryString

protected String buildQueryString(boolean forCountRow)

count

public long count()
Description copied from interface: Projectable
return the amount of matched rows


exists

public boolean exists()
Returns:
true, if rows matching the given criteria exist, otherwise false

createSerializer

protected SQLSerializer createSerializer()

from

public Q from(Expression<?>... args)

from

public Q from(SubQueryExpression<?> subQuery,
              Path<?> alias)

fullJoin

public Q fullJoin(RelationalPath<?> target)

fullJoin

public Q fullJoin(SubQueryExpression<?> target,
                  Path<?> alias)

fullJoin

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

innerJoin

public Q innerJoin(RelationalPath<?> target)

innerJoin

public Q innerJoin(SubQueryExpression<?> target,
                   Path<?> alias)

innerJoin

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

join

public Q join(RelationalPath<?> target)

join

public Q join(SubQueryExpression<?> target,
              Path<?> alias)

join

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

leftJoin

public Q leftJoin(RelationalPath<?> target)

leftJoin

public Q leftJoin(SubQueryExpression<?> target,
                  Path<?> alias)

leftJoin

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

rightJoin

public Q rightJoin(RelationalPath<?> target)

rightJoin

public Q rightJoin(SubQueryExpression<?> target,
                   Path<?> alias)

rightJoin

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

getMetadata

public QueryMetadata getMetadata()

getResults

public ResultSet getResults(Expression<?>... exprs)

getConfiguration

protected Configuration getConfiguration()

iterate

public com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expression<?>[] args)
Description copied from interface: Projectable
iterate over the results for the given projection

Returns:

iterate

public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate(Expression<RT> expr)
Description copied from interface: Projectable
iterate over the results for the given projection

Type Parameters:
RT - generic type of the Iterator
Returns:
an Iterator over the projection

list

public List<Object[]> list(Expression<?>[] args)
Description copied from interface: Projectable
list the results for the given projection An empty list is returned for no results.

Specified by:
list in interface Projectable
Overrides:
list in class ProjectableQuery<Q extends AbstractSQLQuery<Q>>
Returns:

list

public <RT> List<RT> list(Expression<RT> expr)
Description copied from interface: Projectable
list the results for the given projection An empty list is returned for no results.

Specified by:
list in interface Projectable
Overrides:
list in class ProjectableQuery<Q extends AbstractSQLQuery<Q>>
Type Parameters:
RT - generic type of the List
Returns:
a List over the projection

listResults

public <RT> SearchResults<RT> listResults(Expression<RT> expr)
Description copied from interface: Projectable
list the results for the given projection

Returns:

on

public Q on(Predicate... conditions)

setParameters

protected void setParameters(PreparedStatement stmt,
                             List<?> objects,
                             List<Path<?>> constantPaths,
                             Map<ParamExpression<?>,?> params)

toString

public String toString()
Overrides:
toString in class QueryBase<Q extends AbstractSQLQuery<Q>>

union

public <RT> AbstractSQLQuery.UnionBuilder<RT> union(ListSubQuery<RT>... sq)

union

public <RT> AbstractSQLQuery.UnionBuilder<RT> union(SubQueryExpression<RT>... sq)

unionAll

public <RT> AbstractSQLQuery.UnionBuilder<RT> unionAll(ListSubQuery<RT>... sq)

unionAll

public <RT> AbstractSQLQuery.UnionBuilder<RT> unionAll(SubQueryExpression<RT>... sq)

uniqueResult

public <RT> RT uniqueResult(Expression<RT> expr)
Description copied from interface: Projectable
return a unique result for the given projection or null if no result is found

Type Parameters:
RT - return type
Returns:
the result or null for an empty result

uniqueResult

public Object[] uniqueResult(Expression<?>[] expr)
Description copied from interface: Projectable
return a unique result for the given projection or null if no result is found

Returns:


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