com.mysema.query.jpa.impl
Class AbstractJPAQuery<Q extends AbstractJPAQuery<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.jpa.JPQLQueryBase<Q>
              extended by com.mysema.query.jpa.impl.AbstractJPAQuery<Q>
Type Parameters:
Q -
All Implemented Interfaces:
Projectable
Direct Known Subclasses:
JPAQuery

public abstract class AbstractJPAQuery<Q extends AbstractJPAQuery<Q>>
extends JPQLQueryBase<Q>

Abstract base class for JPA API based implementations of the JPQLQuery interface

Author:
tiwe

Field Summary
protected  boolean factoryExpressionUsed
           
protected  javax.persistence.FlushModeType flushMode
           
protected  Map<String,Object> hints
           
protected  javax.persistence.LockModeType lockMode
           
 
Constructor Summary
AbstractJPAQuery(javax.persistence.EntityManager em)
           
AbstractJPAQuery(JPASessionHolder sessionHolder, JPQLTemplates patterns, QueryMetadata metadata)
           
 
Method Summary
 long count()
          return the amount of matched rows
 javax.persistence.Query createQuery(Expression<?> expr)
          Expose the original JPA query for the given projection
 javax.persistence.Query createQuery(Expression<?>[] args)
          Expose the original JPA query for the given projection
 javax.persistence.Query createQuery(Expression<?> expr1, Expression<?> expr2, Expression<?>... rest)
          Expose the original JPA query for the given projection
 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> projection)
          iterate over the results for the given projection
 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
protected  void logQuery(String queryString)
           
 Q setFlushMode(javax.persistence.FlushModeType flushMode)
           
 Q setHint(String name, Object value)
           
 Q setLockMode(javax.persistence.LockModeType lockMode)
           
 Object[] uniqueResult(Expression<?>[] args)
          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.jpa.JPQLQueryBase
buildQueryString, exists, fetch, fetchAll, from, fullJoin, fullJoin, fullJoin, fullJoin, fullJoin, fullJoin, getConstants, getMetadata, getQueryMixin, getTemplates, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, join, join, join, join, join, join, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, reset, setConstants, toCountRowsString, toQueryString, toString, with
 
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, 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
 

Field Detail

hints

protected final Map<String,Object> hints

lockMode

@Nullable
protected javax.persistence.LockModeType lockMode

flushMode

@Nullable
protected javax.persistence.FlushModeType flushMode

factoryExpressionUsed

protected boolean factoryExpressionUsed
Constructor Detail

AbstractJPAQuery

public AbstractJPAQuery(javax.persistence.EntityManager em)

AbstractJPAQuery

public AbstractJPAQuery(JPASessionHolder sessionHolder,
                        JPQLTemplates patterns,
                        QueryMetadata metadata)
Method Detail

count

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


createQuery

public javax.persistence.Query createQuery(Expression<?> expr)
Expose the original JPA query for the given projection

Parameters:
expr -
Returns:

createQuery

public javax.persistence.Query createQuery(Expression<?> expr1,
                                           Expression<?> expr2,
                                           Expression<?>... rest)
Expose the original JPA query for the given projection

Parameters:
expr -
Returns:

createQuery

public javax.persistence.Query createQuery(Expression<?>[] args)
Expose the original JPA query for the given projection

Parameters:
args -
Returns:

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> projection)
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 AbstractJPAQuery<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 AbstractJPAQuery<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:

logQuery

protected void logQuery(String queryString)

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

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

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

uniqueResult

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

There is some ambiguity for missing results and null valued results, for disambiguation use the list or iterate methods instead.

Returns:

setLockMode

public Q setLockMode(javax.persistence.LockModeType lockMode)

setFlushMode

public Q setFlushMode(javax.persistence.FlushModeType flushMode)

setHint

public Q setHint(String name,
                 Object value)


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