Package net.sf.basedb.core.hibernate
Class StatelessSessionWrapper
java.lang.Object
net.sf.basedb.core.hibernate.AbstractQueryCache
net.sf.basedb.core.hibernate.StatelessSessionWrapper
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
,QueryProducer
,SharedSessionContract
,StatelessSession
Wrapper around stateless Hibernate sessions that includes a query cache.
This wrapper forwards all calls to the underlying real Hibernate
session.
- Since:
- 2.16
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2019-09-26 15:49:09 +0200 (tors, 26 sep. 2019) $
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStatelessSessionWrapper
(StatelessSession session) Creates a new session wrapper -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancels the currently executing query in the same manner asSession.cancelQuery()
.void
close()
Deprecated.createCriteria
(Class persistentClass) Deprecated.createCriteria
(Class persistentClass, String alias) Deprecated.createCriteria
(String entityName) Deprecated.createCriteria
(String entityName, String alias) Deprecated.Query<?>
createNamedQuery
(String queryName) <R> Query<R>
createNamedQuery
(String queryName, Class<R> returnType) NativeQuery<?>
createNativeQuery
(String queryString) <R> NativeQuery<R>
createNativeQuery
(String queryString, Class<R> resultClass) NativeQuery<?>
createNativeQuery
(String queryString, String resultSetMapping) Query<?>
createQuery
(String queryString) If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.<R> Query<R>
createQuery
(String queryString, Class<R> resultClass) createQuery
(javax.persistence.criteria.CriteriaDelete c) <T> Query<T>
createQuery
(javax.persistence.criteria.CriteriaQuery<T> c) createQuery
(javax.persistence.criteria.CriteriaUpdate c) NativeQuery<?>
createSQLQuery
(String queryString) If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.createStoredProcedureCall
(String paramString, Class... paramArrayOfClass) createStoredProcedureCall
(String paramString, String... paramArrayOfString) void
void
get
(Class entityClass, Serializable id) get
(Class entityClass, Serializable id, LockMode lockMode) get
(String entityName, Serializable id) get
(String entityName, Serializable id, LockMode lockMode) NativeQuery<?>
getNamedNativeQuery
(String queryName) getNamedProcedureCall
(String name) Query<?>
getNamedQuery
(String queryName) If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.Get the underlying parent session from Hibernate.boolean
boolean
isOpen()
void
void
void
void
void
setJdbcBatchSize
(Integer batchSize) void
void
Methods inherited from class net.sf.basedb.core.hibernate.AbstractQueryCache
cacheQuery, getCachedQuery, getCachedQuery
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.query.QueryProducer
getNamedSQLQuery
Methods inherited from interface org.hibernate.SharedSessionContract
doReturningWork, doWork
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
session
-
-
Constructor Details
-
StatelessSessionWrapper
Creates a new session wrapper- Parameters:
session
- The real Hibernate session
-
-
Method Details
-
getParentSession
Get the underlying parent session from Hibernate. -
cancelQuery
Cancels the currently executing query in the same manner asSession.cancelQuery()
. Since this method is not part of the StatelessSession interface this only works if the underlying parent session is the Hibernate implementation.- Throws:
HibernateException
-
beginTransaction
- Specified by:
beginTransaction
in interfaceSharedSessionContract
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSharedSessionContract
- Specified by:
close
in interfaceStatelessSession
-
connection
Deprecated.- Specified by:
connection
in interfaceStatelessSession
-
createCriteria
Deprecated.- Specified by:
createCriteria
in interfaceSharedSessionContract
-
createCriteria
Deprecated.- Specified by:
createCriteria
in interfaceSharedSessionContract
-
createCriteria
Deprecated.- Specified by:
createCriteria
in interfaceSharedSessionContract
-
createCriteria
Deprecated.- Specified by:
createCriteria
in interfaceSharedSessionContract
-
createQuery
If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.- Specified by:
createQuery
in interfaceQueryProducer
- Specified by:
createQuery
in interfaceSharedSessionContract
- Throws:
HibernateException
-
createSQLQuery
If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.- Specified by:
createSQLQuery
in interfaceQueryProducer
- Specified by:
createSQLQuery
in interfaceStatelessSession
- Throws:
HibernateException
-
delete
- Specified by:
delete
in interfaceStatelessSession
-
delete
- Specified by:
delete
in interfaceStatelessSession
-
get
- Specified by:
get
in interfaceStatelessSession
-
get
- Specified by:
get
in interfaceStatelessSession
-
get
- Specified by:
get
in interfaceStatelessSession
-
get
- Specified by:
get
in interfaceStatelessSession
-
getNamedQuery
If the same query has been executed before, return the cached instance, otherwise create a new query from the parent session and cache it.- Specified by:
getNamedQuery
in interfaceQueryProducer
- Specified by:
getNamedQuery
in interfaceSharedSessionContract
- Throws:
HibernateException
-
getTransaction
- Specified by:
getTransaction
in interfaceSharedSessionContract
-
insert
- Specified by:
insert
in interfaceStatelessSession
-
insert
- Specified by:
insert
in interfaceStatelessSession
-
refresh
- Specified by:
refresh
in interfaceStatelessSession
-
refresh
- Specified by:
refresh
in interfaceStatelessSession
-
refresh
- Specified by:
refresh
in interfaceStatelessSession
-
refresh
- Specified by:
refresh
in interfaceStatelessSession
-
update
- Specified by:
update
in interfaceStatelessSession
-
update
- Specified by:
update
in interfaceStatelessSession
-
getTenantIdentifier
- Specified by:
getTenantIdentifier
in interfaceSharedSessionContract
-
getNamedProcedureCall
- Specified by:
getNamedProcedureCall
in interfaceSharedSessionContract
-
createStoredProcedureCall
- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
-
createStoredProcedureCall
- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
-
createStoredProcedureCall
- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
-
getJdbcBatchSize
- Specified by:
getJdbcBatchSize
in interfaceSharedSessionContract
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceSharedSessionContract
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceSharedSessionContract
-
setJdbcBatchSize
- Specified by:
setJdbcBatchSize
in interfaceSharedSessionContract
-
createNamedQuery
- Specified by:
createNamedQuery
in interfaceQueryProducer
-
createNamedQuery
- Specified by:
createNamedQuery
in interfaceQueryProducer
-
createNativeQuery
- Specified by:
createNativeQuery
in interfaceQueryProducer
-
createNativeQuery
- Specified by:
createNativeQuery
in interfaceQueryProducer
-
createNativeQuery
- Specified by:
createNativeQuery
in interfaceQueryProducer
-
createQuery
- Specified by:
createQuery
in interfaceQueryProducer
-
getNamedNativeQuery
- Specified by:
getNamedNativeQuery
in interfaceQueryProducer
-
createQuery
- Specified by:
createQuery
in interfaceQueryProducer
-
createQuery
- Specified by:
createQuery
in interfaceQueryProducer
-
createQuery
- Specified by:
createQuery
in interfaceQueryProducer
-