public interface StatelessSession extends SharedSessionContract, AutoCloseable, Closeable
A command-oriented API for performing bulk operations against a database. <p/> A stateless session does not implement a first-level cache nor interact with any second-level cache, nor does it implement transactional write-behind or automatic dirty checking, nor do operations cascade to associated instances. Collections are ignored by a stateless session. Operations performed via a stateless session bypass Hibernate’s event model and interceptors. Stateless sessions are vulnerable to data aliasing effects, due to the lack of a first-level cache. <p/> For certain kinds of transactions, a stateless session may perform slightly faster than a stateful session.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stateless session and release the JDBC connection.
|
Connection |
connection()
Deprecated.
just missed when deprecating same method from
Session |
void |
delete(Object entity)
Delete a row.
|
void |
delete(String entityName,
Object entity)
Delete a row.
|
Object |
get(Class entityClass,
Serializable id)
Retrieve a row.
|
Object |
get(Class entityClass,
Serializable id,
LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
|
Object |
get(String entityName,
Serializable id)
Retrieve a row.
|
Object |
get(String entityName,
Serializable id,
LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
|
Serializable |
insert(Object entity)
Insert a row.
|
Serializable |
insert(String entityName,
Object entity)
Insert a row.
|
void |
refresh(Object entity)
Refresh the entity instance state from the database.
|
void |
refresh(Object entity,
LockMode lockMode)
Refresh the entity instance state from the database.
|
void |
refresh(String entityName,
Object entity)
Refresh the entity instance state from the database.
|
void |
refresh(String entityName,
Object entity,
LockMode lockMode)
Refresh the entity instance state from the database.
|
void |
update(Object entity)
Update a row.
|
void |
update(String entityName,
Object entity)
Update a row.
|
beginTransaction, createCriteria, createCriteria, createCriteria, createCriteria, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureCall, getJdbcBatchSize, getNamedProcedureCall, getTenantIdentifier, getTransaction, isConnected, isOpen, setJdbcBatchSize
createNamedQuery, createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createSQLQuery, getNamedNativeQuery, getNamedQuery, getNamedSQLQuery
void close()
Close the stateless session and release the JDBC connection.
close
in interface AutoCloseable
close
in interface Closeable
close
in interface SharedSessionContract
Serializable insert(Object entity)
Insert a row.
entity
- a new transient instanceSerializable insert(String entityName, Object entity)
Insert a row.
entityName
- The entityName for the entity to be insertedentity
- a new transient instancevoid update(Object entity)
Update a row.
entity
- a detached entity instancevoid update(String entityName, Object entity)
Update a row.
entityName
- The entityName for the entity to be updatedentity
- a detached entity instancevoid delete(Object entity)
Delete a row.
entity
- a detached entity instancevoid delete(String entityName, Object entity)
Delete a row.
entityName
- The entityName for the entity to be deletedentity
- a detached entity instanceObject get(String entityName, Serializable id)
Retrieve a row.
entityName
- The name of the entity to retrieveid
- The id of the entity to retrieveObject get(Class entityClass, Serializable id)
Retrieve a row.
entityClass
- The class of the entity to retrieveid
- The id of the entity to retrieveObject get(String entityName, Serializable id, LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
entityName
- The name of the entity to retrieveid
- The id of the entity to retrievelockMode
- The lock mode to apply to the entityObject get(Class entityClass, Serializable id, LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
entityClass
- The class of the entity to retrieveid
- The id of the entity to retrievelockMode
- The lock mode to apply to the entityvoid refresh(Object entity)
Refresh the entity instance state from the database.
entity
- The entity to be refreshed.void refresh(String entityName, Object entity)
Refresh the entity instance state from the database.
entityName
- The entityName for the entity to be refreshed.entity
- The entity to be refreshed.void refresh(Object entity, LockMode lockMode)
Refresh the entity instance state from the database.
entity
- The entity to be refreshed.lockMode
- The LockMode to be applied.void refresh(String entityName, Object entity, LockMode lockMode)
Refresh the entity instance state from the database.
entityName
- The entityName for the entity to be refreshed.entity
- The entity to be refreshed.lockMode
- The LockMode to be applied.@Deprecated Connection connection()
Session
Returns the current JDBC connection associated with this instance.<br> <br> If the session is using aggressive connection release (as in a CMT environment), it is the application’s responsibility to close the connection returned by this call. Otherwise, the application should not close the connection.
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.