public abstract class AbstractSessionImpl extends Object implements Serializable, SharedSessionContract, SessionImplementor, JdbcSessionOwner, TransactionCoordinatorBuilder.TransactionCoordinatorOptions, WrapperOptionsContext
Modifier and Type | Class and Description |
---|---|
class |
AbstractSessionImpl.JdbcObserverImpl |
class |
AbstractSessionImpl.JdbcSessionContextImpl |
LobCreationContext.Callback<T>
Modifier and Type | Field and Description |
---|---|
protected Transaction |
currentHibernateTransaction |
protected SessionFactoryImpl |
factory |
protected WrapperOptionsImpl |
wrapperOptions |
Modifier | Constructor and Description |
---|---|
protected |
AbstractSessionImpl(SessionFactoryImpl factory,
String tenantIdentifier) |
Modifier and Type | Method and Description |
---|---|
Query |
createQuery(NamedQueryDefinition namedQueryDefinition)
Used from EntityManager
|
Query |
createQuery(String queryString)
Create a
Query instance for the given HQL query string. |
SQLQuery |
createSQLQuery(NamedSQLQueryDefinition namedQueryDefinition)
Used from EntityManager
|
SQLQuery |
createSQLQuery(String sql)
Create a
SQLQuery instance for the given SQL 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.
|
protected void |
errorIfClosed() |
<T> T |
execute(LobCreationContext.Callback<T> callback)
Execute the given callback, making sure it has access to a viable JDBC
Connection . |
EntityKey |
generateEntityKey(Serializable id,
EntityPersister persister)
Hide the changing requirements of entity key creation
|
SessionFactoryImplementor |
getFactory()
Get the creating SessionFactoryImplementor
|
protected HQLQueryPlan |
getHQLQueryPlan(String query,
boolean shallow) |
JdbcConnectionAccess |
getJdbcConnectionAccess()
Provides access to JDBC connections
|
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 defined in the metadata. |
Query |
getNamedSQLQuery(String queryName)
Get a Query instance for a named native SQL query
|
protected NativeSQLQueryPlan |
getNativeSQLQueryPlan(NativeSQLQuerySpecification spec) |
UUID |
getSessionIdentifier() |
String |
getTenantIdentifier()
Obtain the tenant identifier associated with this session.
|
Transaction |
getTransaction()
Get the
Transaction instance associated with this session. |
TransactionCoordinatorBuilder |
getTransactionCoordinatorBuilder()
Obtain the builder for TransactionCoordinator instances
|
WrapperOptions |
getWrapperOptions()
Obtain the WrapperOptions for this context.
|
boolean |
isClosed()
Determine whether the session is closed.
|
List |
list(NativeSQLQuerySpecification spec,
QueryParameters queryParameters)
Execute a native SQL query, and return the results as a fully built list.
|
ScrollableResults |
scroll(NativeSQLQuerySpecification spec,
QueryParameters queryParameters)
Execute a native SQL query, and return the results as a scrollable result.
|
protected void |
setClosed() |
abstract boolean |
shouldAutoJoinTransaction()
Indicates whether an active transaction should be automatically joined.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
beginTransaction, createCriteria, createCriteria, createCriteria, createCriteria
afterScrollOperation, bestGuessEntityName, connection, disableTransactionAutoJoin, executeNativeUpdate, executeUpdate, flush, getCacheMode, getContextEntityIdentifier, getDontFlushFromFind, getEntityPersister, getEntityUsingInterceptor, getEventListenerManager, getFlushMode, getInterceptor, getJdbcCoordinator, getLoadQueryInfluencers, getPersistenceContext, getTimestamp, getTransactionCoordinator, guessEntityName, immediateLoad, initializeCollection, instantiate, internalLoad, isAutoCloseSessionEnabled, isConnected, isEventSource, isOpen, isTransactionInProgress, iterate, iterateFilter, list, list, listCustomQuery, listFilter, scroll, scroll, scrollCustomQuery, setAutoClear, setCacheMode, setFlushMode, shouldAutoClose
afterTransactionBegin, afterTransactionCompletion, beforeTransactionCompletion, flushBeforeTransactionCompletion, getJdbcSessionContext
protected transient SessionFactoryImpl factory
protected transient Transaction currentHibernateTransaction
protected transient WrapperOptionsImpl wrapperOptions
protected AbstractSessionImpl(SessionFactoryImpl factory, String tenantIdentifier)
public SessionFactoryImplementor getFactory()
SessionImplementor
getFactory
in interface SessionImplementor
public abstract boolean shouldAutoJoinTransaction()
TransactionCoordinatorBuilder.TransactionCoordinatorOptions
shouldAutoJoinTransaction
in interface TransactionCoordinatorBuilder.TransactionCoordinatorOptions
true
indicates the active transaction should be auto joined; false
indicates it should not (until TransactionCoordinator.explicitJoin()
is called).public <T> T execute(LobCreationContext.Callback<T> callback)
LobCreationContext
Connection
.execute
in interface LobCreationContext
T
- The Java type of the type of LOB being created. One of Blob
,
Clob
, NClob
callback
- The callback to execute .public boolean isClosed()
SessionImplementor
SessionImplementor.isOpen()
as this method does not attempt any JTA synchronization
registration, where as SessionImplementor.isOpen()
does; which makes this one
nicer to use for most internal purposes.isClosed
in interface SessionImplementor
protected void setClosed()
protected void errorIfClosed()
public Query createQuery(NamedQueryDefinition namedQueryDefinition)
SessionImplementor
createQuery
in interface SessionImplementor
namedQueryDefinition
- The named query definitionpublic SQLQuery createSQLQuery(NamedSQLQueryDefinition namedQueryDefinition)
SessionImplementor
createSQLQuery
in interface SessionImplementor
namedQueryDefinition
- The named query definitionpublic Query getNamedQuery(String queryName) throws MappingException
SharedSessionContract
Query
instance for the named query string defined in the metadata.getNamedQuery
in interface SessionImplementor
getNamedQuery
in interface SharedSessionContract
queryName
- the name of a query defined externallyMappingException
public Query getNamedSQLQuery(String queryName) throws MappingException
SessionImplementor
getNamedSQLQuery
in interface SessionImplementor
MappingException
public Query createQuery(String queryString)
SharedSessionContract
Query
instance for the given HQL query string.createQuery
in interface SharedSessionContract
queryString
- The HQL querypublic SQLQuery createSQLQuery(String sql)
SharedSessionContract
SQLQuery
instance for the given SQL query string.createSQLQuery
in interface SharedSessionContract
sql
- The SQL querypublic ProcedureCall getNamedProcedureCall(String name)
SharedSessionContract
getNamedProcedureCall
in interface SharedSessionContract
name
- The name given to the templateNamedStoredProcedureQuery
public ProcedureCall createStoredProcedureCall(String procedureName)
SharedSessionContract
createStoredProcedureCall
in interface SharedSessionContract
procedureName
- The name of the procedure.public ProcedureCall createStoredProcedureCall(String procedureName, Class... resultClasses)
SharedSessionContract
createStoredProcedureCall
in interface SharedSessionContract
procedureName
- The name of the procedure.resultClasses
- The entity(s) to map the result on to.public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings)
SharedSessionContract
createStoredProcedureCall
in interface SharedSessionContract
procedureName
- The name of the procedure.resultSetMappings
- The explicit result set mapping(s) to use for mapping the resultsprotected HQLQueryPlan getHQLQueryPlan(String query, boolean shallow) throws HibernateException
HibernateException
protected NativeSQLQueryPlan getNativeSQLQueryPlan(NativeSQLQuerySpecification spec) throws HibernateException
HibernateException
public Transaction getTransaction() throws HibernateException
SharedSessionContract
Transaction
instance associated with this session. The concrete type of the returned
Transaction
object is determined by the hibernate.transaction_factory
property.getTransaction
in interface SharedSessionContract
HibernateException
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException
SessionImplementor
list
in interface SessionImplementor
spec
- The specification of the native SQL query to execute.queryParameters
- The parameters by which to perform the execution.HibernateException
public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException
SessionImplementor
scroll
in interface SessionImplementor
spec
- The specification of the native SQL query to execute.queryParameters
- The parameters by which to perform the execution.HibernateException
public String getTenantIdentifier()
SharedSessionContract
getTenantIdentifier
in interface SessionImplementor
getTenantIdentifier
in interface SharedSessionContract
null
public EntityKey generateEntityKey(Serializable id, EntityPersister persister)
SessionImplementor
generateEntityKey
in interface SessionImplementor
id
- The entity idpersister
- The entity persisterpublic JdbcConnectionAccess getJdbcConnectionAccess()
SessionImplementor
getJdbcConnectionAccess
in interface SessionImplementor
getJdbcConnectionAccess
in interface JdbcSessionOwner
public UUID getSessionIdentifier()
public TransactionCoordinatorBuilder getTransactionCoordinatorBuilder()
JdbcSessionOwner
getTransactionCoordinatorBuilder
in interface JdbcSessionOwner
public WrapperOptions getWrapperOptions()
WrapperOptionsContext
getWrapperOptions
in interface WrapperOptionsContext
Copyright © 2016 JBoss by Red Hat. All rights reserved.