com.mysema.query.hql.hibernate.sql
Class HibernateSQLQuery

java.lang.Object
  extended by com.mysema.query.support.QueryBase<Q>
      extended by com.mysema.query.support.ProjectableQuery<T>
          extended by com.mysema.query.hql.AbstractSQLQuery<HibernateSQLQuery>
              extended by com.mysema.query.hql.hibernate.sql.HibernateSQLQuery
All Implemented Interfaces:
Projectable

public final class HibernateSQLQuery
extends AbstractSQLQuery<HibernateSQLQuery>

HibernateSQLQuery is an SQLQuery implementation that uses Hibernate's Native SQL functionality to execute queries

Author:
tiwe

Field Summary
 
Fields inherited from class com.mysema.query.support.QueryBase
queryMixin
 
Constructor Summary
protected HibernateSQLQuery(SessionHolder session, SQLTemplates sqlTemplates, QueryMetadata metadata)
           
  HibernateSQLQuery(org.hibernate.Session session, SQLTemplates sqlTemplates)
           
  HibernateSQLQuery(org.hibernate.StatelessSession session, SQLTemplates sqlTemplates)
           
 
Method Summary
 HibernateSQLQuery clone(org.hibernate.Session session)
           
 org.hibernate.Query createQuery(Expr<?>... args)
           
 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> projection)
          iterate over the results for the given projection
 List<Object[]> list(Expr<?>[] projection)
          list the results for the given projection
<RT> List<RT>
list(Expr<RT> projection)
          list the results for the given projection
<RT> SearchResults<RT>
listResults(Expr<RT> projection)
          list the results for the given projection
protected  void logQuery(String queryString)
           
protected  void reset()
           
 HibernateSQLQuery setCacheable(boolean cacheable)
          Enable caching of this query result set.
 HibernateSQLQuery setCacheRegion(String cacheRegion)
          Set the name of the cache region.
 HibernateSQLQuery setFetchSize(int fetchSize)
          Set a fetch size for the underlying JDBC query.
 HibernateSQLQuery 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.
 HibernateSQLQuery setTimeout(int timeout)
          Set a timeout for the underlying JDBC query.
protected  String toCountRowsString()
           
protected  String toQueryString()
           
<RT> RT
uniqueResult(Expr<RT> expr)
          return a unique result for the given projection
 
Methods inherited from class com.mysema.query.hql.AbstractSQLQuery
count, from, fullJoin, getMetadata, innerJoin, join, leftJoin, on
 
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, toString, where
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HibernateSQLQuery

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

HibernateSQLQuery

protected HibernateSQLQuery(SessionHolder session,
                            SQLTemplates sqlTemplates,
                            QueryMetadata metadata)

HibernateSQLQuery

public HibernateSQLQuery(org.hibernate.StatelessSession session,
                         SQLTemplates sqlTemplates)
Method Detail

clone

public HibernateSQLQuery clone(org.hibernate.Session session)

createQuery

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

list

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

Specified by:
list in interface Projectable
Overrides:
list in class ProjectableQuery<HibernateSQLQuery>
Returns:

list

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

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

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

listResults

public <RT> SearchResults<RT> listResults(Expr<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 <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<HibernateSQLQuery>
Type Parameters:
RT - return type
Returns:
the result or null for an empty result

setCacheable

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

Parameters:
cacheable - Should the query results be cacheable?

setCacheRegion

public HibernateSQLQuery 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 HibernateSQLQuery setFetchSize(int fetchSize)
Set a fetch size for the underlying JDBC query.

Parameters:
fetchSize - the fetch size

setReadOnly

public HibernateSQLQuery 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 HibernateSQLQuery setTimeout(int timeout)
Set a timeout for the underlying JDBC query.

Parameters:
timeout - the timeout in seconds


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