com.mysema.query.jpa.hibernate.sql
Class AbstractHibernateSQLQuery<Q extends AbstractHibernateSQLQuery<Q>>

java.lang.Object
  extended by com.mysema.query.support.QueryBase<Q>
      extended by com.mysema.query.support.ProjectableQuery<T>
          extended by com.mysema.query.jpa.AbstractSQLQuery<Q>
              extended by com.mysema.query.jpa.hibernate.sql.AbstractHibernateSQLQuery<Q>
Type Parameters:
Q -
All Implemented Interfaces:
Projectable
Direct Known Subclasses:
HibernateSQLQuery

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

Author:
tiwe

Field Summary
protected  SQLTemplates sqlTemplates
           
 
Fields inherited from class com.mysema.query.support.QueryBase
queryMixin
 
Constructor Summary
AbstractHibernateSQLQuery(SessionHolder session, SQLTemplates sqlTemplates, QueryMetadata metadata)
           
AbstractHibernateSQLQuery(org.hibernate.Session session, SQLTemplates sqlTemplates)
           
AbstractHibernateSQLQuery(org.hibernate.StatelessSession session, SQLTemplates sqlTemplates)
           
 
Method Summary
 org.hibernate.Query createQuery(Expression<?>... args)
           
 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<?>[] projection)
          list the results for the given projection An empty list is returned for no results.
<RT> List<RT>
list(Expression<RT> projection)
          list the results for the given projection An empty list is returned for no results.
<RT> SearchResults<RT>
listResults(Expression<RT> projection)
          list the results for the given projection
protected  void logQuery(String queryString)
           
protected  void reset()
           
 Q setCacheable(boolean cacheable)
          Enable caching of this query result set.
 Q setCacheRegion(String cacheRegion)
          Set the name of the cache region.
 Q setFetchSize(int fetchSize)
          Set a fetch size for the underlying JDBC query.
 Q setReadOnly(boolean readOnly)
          Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent.
 Q setTimeout(int timeout)
          Set a timeout for the underlying JDBC query.
protected  String toCountRowsString()
           
protected  String toQueryString()
           
 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.AbstractSQLQuery
addFlag, addFlag, addFlag, addJoinFlag, addJoinFlag, count, exists, from, from, fullJoin, fullJoin, fullJoin, getMetadata, innerJoin, innerJoin, innerJoin, join, join, join, leftJoin, leftJoin, leftJoin, on, rightJoin, rightJoin, rightJoin
 
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, toString, where
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sqlTemplates

protected final SQLTemplates sqlTemplates
Constructor Detail

AbstractHibernateSQLQuery

public AbstractHibernateSQLQuery(org.hibernate.Session session,
                                 SQLTemplates sqlTemplates)

AbstractHibernateSQLQuery

public AbstractHibernateSQLQuery(org.hibernate.StatelessSession session,
                                 SQLTemplates sqlTemplates)

AbstractHibernateSQLQuery

public AbstractHibernateSQLQuery(SessionHolder session,
                                 SQLTemplates sqlTemplates,
                                 QueryMetadata metadata)
Method Detail

createQuery

public org.hibernate.Query createQuery(Expression<?>... args)

list

public List<Object[]> list(Expression<?>[] projection)
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 AbstractHibernateSQLQuery<Q>>
Returns:

list

public <RT> List<RT> list(Expression<RT> projection)
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 AbstractHibernateSQLQuery<Q>>
Type Parameters:
RT - generic type of the List
Returns:
a List over the projection

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

listResults

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

Returns:

logQuery

protected void logQuery(String queryString)

reset

protected void reset()

toCountRowsString

protected String toCountRowsString()

toQueryString

protected String toQueryString()

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

Returns:

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

setCacheable

public Q setCacheable(boolean cacheable)
Enable caching of this query result set.

Parameters:
cacheable - Should the query results be cacheable?

setCacheRegion

public Q setCacheRegion(String cacheRegion)
Set the name of the cache region.

Parameters:
cacheRegion - the name of a query cache region, or null for the default query cache

setFetchSize

public Q setFetchSize(int fetchSize)
Set a fetch size for the underlying JDBC query.

Parameters:
fetchSize - the fetch size

setReadOnly

public Q setReadOnly(boolean readOnly)
Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent.


setTimeout

public Q setTimeout(int timeout)
Set a timeout for the underlying JDBC query.

Parameters:
timeout - the timeout in seconds


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