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

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

AbstractSQLQuery is the base type for SQL query implementations

Version:
$Id$
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
protected  Q addFlag(QueryFlag.Position position, Expr<?> flag)
           
protected  Q addFlag(QueryFlag.Position position, String flag)
           
protected  Q addFlag(QueryFlag.Position position, String prefix, Expr<?> expr)
           
protected  Q addJoinFlag(String flag)
           
protected  String buildQueryString(boolean forCountRow)
           
 long count()
          return the amount of matched rows
protected  SQLSerializer createSerializer()
           
 Q from(Expr<?>... args)
           
<E> Q
fullJoin(ForeignKey<E> key, PEntity<E> entity)
           
 Q fullJoin(PEntity<?> target)
           
 Q fullJoin(SubQuery<?> target, Path<?> alias)
           
protected  Configuration getConfiguration()
           
 QueryMetadata getMetadata()
           
 ResultSet getResults(Expr<?>... exprs)
           
<E> Q
innerJoin(ForeignKey<E> key, PEntity<E> entity)
           
 Q innerJoin(PEntity<?> target)
           
 Q innerJoin(SubQuery<?> target, Path<?> alias)
           
 com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expr<?>[] args)
          iterate over the results for the given projection
<RT> com.mysema.commons.lang.CloseableIterator<RT>
iterate(Expr<RT> expr)
          iterate over the results for the given projection
<E> Q
join(ForeignKey<E> key, PEntity<E> entity)
           
 Q join(PEntity<?> target)
           
 Q join(SubQuery<?> target, Path<?> alias)
           
<E> Q
leftJoin(ForeignKey<E> key, PEntity<E> entity)
           
 Q leftJoin(PEntity<?> target)
           
 Q leftJoin(SubQuery<?> target, Path<?> alias)
           
 List<Object[]> list(Expr<?>[] args)
          list the results for the given projection
<RT> List<RT>
list(Expr<RT> expr)
          list the results for the given projection
<RT> SearchResults<RT>
listResults(Expr<RT> expr)
          list the results for the given projection
 Q on(EBoolean... conditions)
           
<E> Q
rightJoin(ForeignKey<E> key, PEntity<E> entity)
           
 Q rightJoin(PEntity<?> target)
           
 Q rightJoin(SubQuery<?> target, Path<?> alias)
           
protected  void setParameters(PreparedStatement stmt, Collection<?> objects, Map<Param<?>,?> params)
           
 String toString()
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
union(ListSubQuery<RT>... sq)
           
<RT> AbstractSQLQuery.UnionBuilder<RT>
union(SubQuery<RT>... sq)
           
<RT> RT
uniqueResult(Expr<RT> expr)
          return a unique result for the given projection
 
Methods inherited from class com.mysema.query.support.ProjectableQuery
countDistinct, iterate, iterateDistinct, iterateDistinct, iterateDistinct, list, listDistinct, listDistinct, listDistinct, listDistinctResults, map, uniqueResult, uniqueResult
 
Methods inherited from class com.mysema.query.support.QueryBase
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

protected Q addJoinFlag(String flag)

addFlag

protected Q addFlag(QueryFlag.Position position,
                    String prefix,
                    Expr<?> expr)

addFlag

protected Q addFlag(QueryFlag.Position position,
                    String flag)

addFlag

protected Q addFlag(QueryFlag.Position position,
                    Expr<?> flag)

buildQueryString

protected String buildQueryString(boolean forCountRow)

count

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


createSerializer

protected SQLSerializer createSerializer()

from

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

fullJoin

public Q fullJoin(PEntity<?> target)

fullJoin

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

fullJoin

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

innerJoin

public Q innerJoin(PEntity<?> target)

innerJoin

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

innerJoin

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

join

public Q join(PEntity<?> target)

join

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

join

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

leftJoin

public Q leftJoin(PEntity<?> target)

leftJoin

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

leftJoin

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

rightJoin

public Q rightJoin(PEntity<?> target)

rightJoin

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

rightJoin

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

getMetadata

public QueryMetadata getMetadata()

getResults

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

getConfiguration

protected Configuration getConfiguration()

iterate

public com.mysema.commons.lang.CloseableIterator<Object[]> iterate(Expr<?>[] 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(Expr<RT> expr)
Description copied from interface: Projectable
iterate over the results for the given projection

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

list

public List<Object[]> list(Expr<?>[] args)
Description copied from interface: Projectable
list the results for the given projection

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

list

public <RT> List<RT> list(Expr<RT> expr)
Description copied from interface: Projectable
list the results for the given projection

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(Expr<RT> expr)
Description copied from interface: Projectable
list the results for the given projection

Returns:

on

public Q on(EBoolean... conditions)

setParameters

protected void setParameters(PreparedStatement stmt,
                             Collection<?> objects,
                             Map<Param<?>,?> 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(SubQuery<RT>... sq)

uniqueResult

public <RT> RT uniqueResult(Expr<RT> expr)
Description copied from interface: Projectable
return a unique result for the given projection

Specified by:
uniqueResult in interface Projectable
Overrides:
uniqueResult in class ProjectableQuery<Q extends AbstractSQLQuery<Q>>
Type Parameters:
RT - return type
Returns:
the result or null for an empty result


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