程序包 org.hibernate
接口 SharedSessionContract
-
- 所有超级接口:
QueryProducer,Serializable
- 所有已知子接口:
EventSource,Session,SessionImplementor,SharedSessionContractImplementor,StatelessSession
- 所有已知实现类:
AbstractSessionImpl,AbstractSharedSessionContract,SessionDelegatorBaseImpl,SessionImpl,StatelessSessionImpl
public interface SharedSessionContract extends QueryProducer, Serializable
Contract methods shared betweenSessionandStatelessSession. NOTE : Poorly named. "shared" simply indicates that its a unified contract betweenSessionandStatelessSession.- 作者:
- Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 默认方法 已过时的方法 修饰符和类型 方法 说明 TransactionbeginTransaction()Begin a unit of work and return the associatedTransactionobject.voidclose()End the session by releasing the JDBC connection and cleaning up.CriteriacreateCriteria(Class persistentClass)已过时。(since 5.2) for Session, use the JPA CriteriaCriteriacreateCriteria(Class persistentClass, String alias)已过时。(since 5.2) for Session, use the JPA CriteriaCriteriacreateCriteria(String entityName)已过时。(since 5.2) for Session, use the JPA CriteriaCriteriacreateCriteria(String entityName, String alias)已过时。(since 5.2) for Session, use the JPA CriteriaQuerycreateQuery(String queryString)Create aQueryinstance for the given HQL/JPQL query string.ProcedureCallcreateStoredProcedureCall(String procedureName)Creates a call to a stored procedure.ProcedureCallcreateStoredProcedureCall(String procedureName, Class... resultClasses)Creates a call to a stored procedure with specific result set entity mappings.ProcedureCallcreateStoredProcedureCall(String procedureName, String... resultSetMappings)Creates a call to a stored procedure with specific result set entity mappings.default <T> TdoReturningWork(ReturningWork<T> work)Controller for allowing users to perform JDBC related work using the Connection managed by this Session.default voiddoWork(Work work)Controller for allowing users to perform JDBC related work using the Connection managed by this Session.IntegergetJdbcBatchSize()Get the Session-level JDBC batch size for the current Session.ProcedureCallgetNamedProcedureCall(String name)Gets a ProcedureCall based on a named templateQuerygetNamedQuery(String queryName)Create aQueryinstance for the named query.StringgetTenantIdentifier()Obtain the tenant identifier associated with this session.TransactiongetTransaction()Get theTransactioninstance associated with this session.booleanisConnected()Check if the session is currently connected.booleanisOpen()Check if the session is still open.voidsetJdbcBatchSize(Integer jdbcBatchSize)Set the Session-level JDBC batch size.-
从接口继承的方法 org.hibernate.query.QueryProducer
createNamedQuery, createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createSQLQuery, getNamedNativeQuery, getNamedSQLQuery
-
-
-
-
方法详细资料
-
getTenantIdentifier
String getTenantIdentifier()
Obtain the tenant identifier associated with this session.- 返回:
- The tenant identifier associated with this session, or
null
-
close
void close() throws HibernateExceptionEnd the session by releasing the JDBC connection and cleaning up.- 抛出:
HibernateException- Indicates problems cleaning up.
-
isOpen
boolean isOpen()
Check if the session is still open.- 返回:
- boolean
-
isConnected
boolean isConnected()
Check if the session is currently connected.- 返回:
- boolean
-
beginTransaction
Transaction beginTransaction()
Begin a unit of work and return the associatedTransactionobject. If a new underlying transaction is required, begin the transaction. Otherwise continue the new work in the context of the existing underlying transaction.- 返回:
- a Transaction instance
- 另请参阅:
getTransaction()
-
getTransaction
Transaction getTransaction()
Get theTransactioninstance associated with this session. The concrete type of the returnedTransactionobject is determined by thehibernate.transaction_factoryproperty.- 返回:
- a Transaction instance
-
createQuery
Query createQuery(String queryString)
从接口复制的说明:QueryProducerCreate aQueryinstance for the given HQL/JPQL query string.- 指定者:
createQuery在接口中QueryProducer- 参数:
queryString- The HQL/JPQL query- 返回:
- The Query instance for manipulation and execution
- 另请参阅:
EntityManager.createQuery(String)
-
getNamedQuery
Query getNamedQuery(String queryName)
从接口复制的说明:QueryProducerCreate aQueryinstance for the named query.- 指定者:
getNamedQuery在接口中QueryProducer- 参数:
queryName- the name of a pre-defined, named query- 返回:
- The Query instance for manipulation and execution
-
getNamedProcedureCall
ProcedureCall getNamedProcedureCall(String name)
Gets a ProcedureCall based on a named template- 参数:
name- The name given to the template- 返回:
- The ProcedureCall
- 另请参阅:
NamedStoredProcedureQuery
-
createStoredProcedureCall
ProcedureCall createStoredProcedureCall(String procedureName)
Creates a call to a stored procedure.- 参数:
procedureName- The name of the procedure.- 返回:
- The representation of the procedure call.
-
createStoredProcedureCall
ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses)
Creates a call to a stored procedure with specific result set entity mappings. Each class named is considered a "root return".- 参数:
procedureName- The name of the procedure.resultClasses- The entity(s) to map the result on to.- 返回:
- The representation of the procedure call.
-
createStoredProcedureCall
ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings)
Creates a call to a stored procedure with specific result set entity mappings.- 参数:
procedureName- The name of the procedure.resultSetMappings- The explicit result set mapping(s) to use for mapping the results- 返回:
- The representation of the procedure call.
-
createCriteria
@Deprecated Criteria createCriteria(Class persistentClass)
已过时。(since 5.2) for Session, use the JPA CriteriaCreateCriteriainstance for the given class (entity or subclasses/implementors).- 参数:
persistentClass- The class, which is an entity, or has entity subclasses/implementors- 返回:
- The criteria instance for manipulation and execution
-
createCriteria
@Deprecated Criteria createCriteria(Class persistentClass, String alias)
已过时。(since 5.2) for Session, use the JPA CriteriaCreateCriteriainstance for the given class (entity or subclasses/implementors), using a specific alias.- 参数:
persistentClass- The class, which is an entity, or has entity subclasses/implementorsalias- The alias to use- 返回:
- The criteria instance for manipulation and execution
-
createCriteria
@Deprecated Criteria createCriteria(String entityName)
已过时。(since 5.2) for Session, use the JPA CriteriaCreateCriteriainstance for the given entity name.- 参数:
entityName- The entity name- 返回:
- The criteria instance for manipulation and execution
-
createCriteria
@Deprecated Criteria createCriteria(String entityName, String alias)
已过时。(since 5.2) for Session, use the JPA CriteriaCreateCriteriainstance for the given entity name, using a specific alias.- 参数:
entityName- The entity namealias- The alias to use- 返回:
- The criteria instance for manipulation and execution
-
getJdbcBatchSize
Integer getJdbcBatchSize()
Get the Session-level JDBC batch size for the current Session. Overrides the SessionFactory JDBC batch size defined by thehibernate.default_batch_fetch_sizeconfiguration property for the scope of the currentSession.- 返回:
- Session-level JDBC batch size
- 从以下版本开始:
- 5.2
- 另请参阅:
SessionFactoryOptions.getJdbcBatchSize(),SessionFactoryBuilder.applyJdbcBatchSize(int)
-
setJdbcBatchSize
void setJdbcBatchSize(Integer jdbcBatchSize)
Set the Session-level JDBC batch size. Overrides the SessionFactory JDBC batch size defined by thehibernate.default_batch_fetch_sizeconfiguration property for the scope of the currentSession.- 参数:
jdbcBatchSize- Session-level JDBC batch size- 从以下版本开始:
- 5.2
- 另请参阅:
SessionFactoryOptions.getJdbcBatchSize(),SessionFactoryBuilder.applyJdbcBatchSize(int)
-
doWork
default void doWork(Work work) throws HibernateException
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.- 参数:
work- The work to be performed.- 抛出:
HibernateException- Generally indicates wrappedSQLException
-
doReturningWork
default <T> T doReturningWork(ReturningWork<T> work) throws HibernateException
Controller for allowing users to perform JDBC related work using the Connection managed by this Session. After execution returns the result of theReturningWork.execute(java.sql.Connection)call.- 类型参数:
T- The type of the result returned from the work- 参数:
work- The work to be performed.- 返回:
- the result from calling
ReturningWork.execute(java.sql.Connection). - 抛出:
HibernateException- Generally indicates wrappedSQLException
-
-