public abstract class AbstractBasicQueryContractImpl extends Object implements BasicQueryContract
Modifier | Constructor and Description |
---|---|
protected |
AbstractBasicQueryContractImpl(SessionImplementor session) |
Modifier and Type | Method and Description |
---|---|
QueryParameters |
buildQueryParametersObject() |
CacheMode |
getCacheMode()
Obtain the CacheMode in effect for this query.
|
String |
getCacheRegion()
Obtain the name of the second level query cache region in which query results will be stored (if they are
cached, see the discussion on
BasicQueryContract.isCacheable() for more information). |
Integer |
getFetchSize()
Obtain the JDBC fetch size hint in effect for this query.
|
FlushMode |
getFlushMode()
Obtain the FlushMode in effect for this query.
|
Integer |
getTimeout()
Obtain the query timeout in seconds.
|
boolean |
isCacheable()
Are the results of this query eligible for second level query caching? This is different that second level
caching of any returned entities and collections.
|
boolean |
isReadOnly()
Should entities and proxies loaded by this Query be put in read-only mode? If the
read-only/modifiable setting was not initialized, then the default
read-only/modifiable setting for the persistence context is returned instead.
|
protected SessionImplementor |
session() |
BasicQueryContract |
setCacheable(boolean cacheable)
Enable/disable second level query (result) caching for this query.
|
BasicQueryContract |
setCacheMode(CacheMode cacheMode)
(Re)set the current CacheMode in effect for this query.
|
BasicQueryContract |
setCacheRegion(String cacheRegion)
Set the name of the cache region where query results should be cached (if cached at all).
|
BasicQueryContract |
setFetchSize(int fetchSize)
Sets a JDBC fetch size hint for the query.
|
BasicQueryContract |
setFlushMode(FlushMode flushMode)
(Re)set the current FlushMode in effect for this query.
|
BasicQueryContract |
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies
loaded by this Query.
|
BasicQueryContract |
setTimeout(int timeout)
Set the query timeout in seconds.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReturnTypes
protected AbstractBasicQueryContractImpl(SessionImplementor session)
protected SessionImplementor session()
public FlushMode getFlushMode()
BasicQueryContract
getFlushMode
in interface BasicQueryContract
Session.getFlushMode()
,
FlushMode
public BasicQueryContract setFlushMode(FlushMode flushMode)
BasicQueryContract
setFlushMode
in interface BasicQueryContract
flushMode
- The new FlushMode to use.this
, for method chainingBasicQueryContract.getFlushMode()
public CacheMode getCacheMode()
BasicQueryContract
getCacheMode
in interface BasicQueryContract
Session.getCacheMode()
,
CacheMode
public BasicQueryContract setCacheMode(CacheMode cacheMode)
BasicQueryContract
setCacheMode
in interface BasicQueryContract
cacheMode
- The new CacheMode to use.this
, for method chainingBasicQueryContract.getCacheMode()
public boolean isCacheable()
BasicQueryContract
SessionFactory
for this to happen. Usually that is
controlled by the hibernate.cache.use_query_cache
configuration setting.isCacheable
in interface BasicQueryContract
true
if the query results are eligible for caching, false
otherwise.AvailableSettings.USE_QUERY_CACHE
public BasicQueryContract setCacheable(boolean cacheable)
BasicQueryContract
setCacheable
in interface BasicQueryContract
cacheable
- Should the query results be cacheable?this
, for method chainingBasicQueryContract.isCacheable()
public String getCacheRegion()
BasicQueryContract
BasicQueryContract.isCacheable()
for more information). null
indicates that the
default region should be used.getCacheRegion
in interface BasicQueryContract
null
indicates
the default region.public BasicQueryContract setCacheRegion(String cacheRegion)
BasicQueryContract
setCacheRegion
in interface BasicQueryContract
cacheRegion
- the name of a query cache region, or null
to indicate that the default region
should be used.this
, for method chainingBasicQueryContract.getCacheRegion()
public boolean isReadOnly()
BasicQueryContract
isReadOnly
in interface BasicQueryContract
Query.setReadOnly(boolean)
,
The read-only/modifiable setting has no impact on entities/proxies returned by the
query that existed in the session before the query was executed.
public BasicQueryContract setReadOnly(boolean readOnly)
BasicQueryContract
setReadOnly
in interface BasicQueryContract
readOnly
- true, entities and proxies loaded by the query will be put in read-only mode
false, entities and proxies loaded by the query will be put in modifiable modethis
, for method chainingTo set the default read-only/modifiable setting used for
entities and proxies that are loaded into the session:
,
PersistenceContext.setDefaultReadOnly(boolean)
,
Read-only entities are not dirty-checked and snapshots of persistent
state are not maintained. Read-only entities can be modified, but
changes are not persisted.
When a proxy is initialized, the loaded entity will have the same
read-only/modifiable setting as the uninitialized
proxy has, regardless of the session's current setting.
The read-only/modifiable setting has no impact on entities/proxies
returned by the query that existed in the session before the query was executed.
public Integer getTimeout()
BasicQueryContract
Statement.setQueryTimeout(int)
. Zero indicates no timeout.getTimeout
in interface BasicQueryContract
Statement.getQueryTimeout()
,
Statement.setQueryTimeout(int)
public BasicQueryContract setTimeout(int timeout)
BasicQueryContract
setTimeout
in interface BasicQueryContract
timeout
- the timeout in secondsthis
, for method chainingBasicQueryContract.getTimeout()
public Integer getFetchSize()
BasicQueryContract
Statement.setFetchSize(int)
. As defined b y JDBC, this value is a hint to the
driver to indicate how many rows to fetch from the database when more rows are needed.
NOTE : JDBC expressly defines this value as a hint. It may or may not have any effect on the actual
query execution and ResultSet processing depending on the driver.getFetchSize
in interface BasicQueryContract
Statement.getFetchSize()
,
Statement.setFetchSize(int)
public BasicQueryContract setFetchSize(int fetchSize)
BasicQueryContract
setFetchSize
in interface BasicQueryContract
fetchSize
- the fetch size hintthis
, for method chainingBasicQueryContract.getFetchSize()
public QueryParameters buildQueryParametersObject()
Copyright © 2016 JBoss by Red Hat. All rights reserved.