public interface SharedSessionContract extends QueryProducer, Serializable
Session
and StatelessSession
.
NOTE : Poorly named. "shared" simply indicates that its a unified contract between Session
and
StatelessSession
.Modifier and Type | Method and Description |
---|---|
Transaction |
beginTransaction()
Begin a unit of work and return the associated
Transaction object. |
void |
close()
End the session by releasing the JDBC connection and cleaning up.
|
<T> Query<T> |
createNamedQuery(String name,
Class<T> resultType)
The JPA-defined named, typed query creation method.
|
Query |
createQuery(CriteriaDelete deleteQuery) |
<T> Query<T> |
createQuery(CriteriaQuery<T> criteriaQuery) |
Query |
createQuery(CriteriaUpdate updateQuery) |
Query |
createQuery(String queryString)
Create a
Query instance for the given HQL/JPQL query string. |
<T> Query<T> |
createQuery(String queryString,
Class<T> resultType)
Create a typed
Query instance for the given HQL/JPQL query string. |
ProcedureCall |
createStoredProcedureCall(String procedureName)
Creates a call to a stored procedure.
|
ProcedureCall |
createStoredProcedureCall(String procedureName,
Class... resultClasses)
Creates a call to a stored procedure with specific result set entity mappings.
|
ProcedureCall |
createStoredProcedureCall(String procedureName,
String... resultSetMappings)
Creates a call to a stored procedure with specific result set entity mappings.
|
default <T> T |
doReturningWork(ReturningWork<T> work)
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
|
default void |
doWork(Work work)
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
|
HibernateCriteriaBuilder |
getCriteriaBuilder()
Return an instance of
CriteriaBuilder |
Integer |
getJdbcBatchSize()
Get the Session-level JDBC batch size for the current Session.
|
ProcedureCall |
getNamedProcedureCall(String name)
Gets a ProcedureCall based on a named template
|
Query |
getNamedQuery(String queryName)
Create a
Query instance for the named query. |
String |
getTenantIdentifier()
Obtain the tenant identifier associated with this session.
|
Transaction |
getTransaction()
Get the
Transaction instance associated with this session. |
boolean |
isConnected()
Check if the session is currently connected.
|
boolean |
isOpen()
Check if the session is still open.
|
void |
setJdbcBatchSize(Integer jdbcBatchSize)
Set the Session-level JDBC batch size.
|
createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, getNamedNativeQuery, getNamedNativeQuery
String getTenantIdentifier()
null
void close() throws HibernateException
HibernateException
- Indicates problems cleaning up.boolean isOpen()
boolean isConnected()
Transaction beginTransaction()
Transaction
object. If a new underlying transaction is
required, begin the transaction. Otherwise continue the new work in the context of the existing underlying
transaction.getTransaction()
Transaction getTransaction()
Transaction
instance associated with this session. The concrete type of the returned
Transaction
object is determined by the hibernate.transaction_factory
property.Query createQuery(String queryString)
QueryProducer
Query
instance for the given HQL/JPQL query string.createQuery
in interface QueryProducer
queryString
- The HQL/JPQL queryEntityManager.createQuery(String)
Query getNamedQuery(String queryName)
QueryProducer
Query
instance for the named query.getNamedQuery
in interface QueryProducer
queryName
- the name of a pre-defined, named queryProcedureCall getNamedProcedureCall(String name)
name
- The name given to the templateNamedStoredProcedureQuery
ProcedureCall createStoredProcedureCall(String procedureName)
procedureName
- The name of the procedure.ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses)
procedureName
- The name of the procedure.resultClasses
- The entity(s) to map the result on to.ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings)
procedureName
- The name of the procedure.resultSetMappings
- The explicit result set mapping(s) to use for mapping the resultsInteger getJdbcBatchSize()
hibernate.default_batch_fetch_size
configuration property for the scope of the current Session
.SessionFactoryOptions.getJdbcBatchSize()
,
SessionFactoryBuilder.applyJdbcBatchSize(int)
void setJdbcBatchSize(Integer jdbcBatchSize)
hibernate.default_batch_fetch_size
configuration property for the scope of the current Session
.jdbcBatchSize
- Session-level JDBC batch sizeSessionFactoryOptions.getJdbcBatchSize()
,
SessionFactoryBuilder.applyJdbcBatchSize(int)
HibernateCriteriaBuilder getCriteriaBuilder()
CriteriaBuilder
IllegalStateException
- if the StatelessSession has been closed<T> Query<T> createQuery(String queryString, Class<T> resultType)
QueryProducer
Query
instance for the given HQL/JPQL query string.createQuery
in interface QueryProducer
queryString
- The HQL/JPQL queryresultType
- The type of the query resultEntityManager.createQuery(String,Class)
<T> Query<T> createQuery(CriteriaQuery<T> criteriaQuery)
createQuery
in interface QueryProducer
Query createQuery(CriteriaUpdate updateQuery)
createQuery
in interface QueryProducer
Query createQuery(CriteriaDelete deleteQuery)
createQuery
in interface QueryProducer
<T> Query<T> createNamedQuery(String name, Class<T> resultType)
QueryProducer
createNamedQuery
in interface QueryProducer
name
- the name of a query defined in metadataresultType
- the type of the query resultEntityManager.createNamedQuery(String,Class)
default void doWork(Work work) throws HibernateException
work
- The work to be performed.HibernateException
- Generally indicates wrapped SQLException
default <T> T doReturningWork(ReturningWork<T> work) throws HibernateException
ReturningWork.execute(java.sql.Connection)
call.T
- The type of the result returned from the workwork
- The work to be performed.ReturningWork.execute(java.sql.Connection)
.HibernateException
- Generally indicates wrapped SQLException
Copyright © 2001-2021 Red Hat, Inc. All Rights Reserved.