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.
For certain kinds of transactions, a stateless session may perform slightly faster than a stateful session.
| Modifier and Type | Method and Description |
|---|---|
| public Transaction | |
| public void | |
| public Connection | |
| public Criteria | Returns: Criteriaa class, which is persistent, or has persistent subclasses persistentClass)Create a new Criteria instance, for the given entity class, or a superclass of an entity class. |
| public Criteria | Returns: Criteriaa class, which is persistent, or has persistent subclasses persistentClass, String alias)Create a new Criteria instance, for the given entity class, or a superclass of an entity class, with the given alias. |
| public Criteria | Returns: CriteriaCreate a new Criteria instance, for the given entity name. |
| public Criteria | Returns: CriteriaCreate a new Criteria instance, for the given entity name, with the given alias. |
| public Query | |
| public SQLQuery | Returns: SQLQuerya SQL query queryString)Create a new instance of SQLQuery for the given SQL query string. |
| public void | |
| public void | |
| public Object | |
| public Object | |
| public Object | Returns: a detached entity instanceRetrieve a row, obtaining the specified lock mode. |
| public Object | Returns: a detached entity instanceRetrieve a row, obtaining the specified lock mode. |
| public Query | getNamedQuery(String queryName)
Obtain an instance of Query for a named query string defined in the mapping file. |
| public Transaction | |
| public Serializable | |
| public Serializable | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void |
| beginTransaction | back to summary |
|---|---|
| public Transaction beginTransaction() Begin a Hibernate transaction. | |
| close | back to summary |
|---|---|
| public void close() Close the stateless session and release the JDBC connection. | |
| connection | back to summary |
|---|---|
| public Connection connection() Returns the current JDBC connection associated with this
instance. | |
| createCriteria | back to summary |
|---|---|
| public Criteria createCriteria(Class<T> persistentClass) Create a new Criteria instance, for the given entity class, or a superclass of an entity class. Entities returned by the query are detached. | |
| createCriteria | back to summary |
|---|---|
| public Criteria createCriteria(Class<T> persistentClass, String alias) Create a new Criteria instance, for the given entity class, or a superclass of an entity class, with the given alias. Entities returned by the query are detached. | |
| createCriteria | back to summary |
|---|---|
| public Criteria createCriteria(String entityName) Create a new Criteria instance, for the given entity name. Entities returned by the query are detached.
| |
| createCriteria | back to summary |
|---|---|
| public Criteria createCriteria(String entityName, String alias) Create a new Criteria instance, for the given entity name, with the given alias. Entities returned by the query are detached.
| |
| createQuery | back to summary |
|---|---|
| public Query createQuery(String queryString) Create a new instance of Query for the given HQL query string. Entities returned by the query are detached. | |
| createSQLQuery | back to summary |
|---|---|
| public SQLQuery createSQLQuery(String queryString) throws HibernateException Create a new instance of SQLQuery for the given SQL query string. Entities returned by the query are detached. | |
| delete | back to summary |
|---|---|
| public void delete(Object entity) Delete a row.
| |
| delete | back to summary |
|---|---|
| public void delete(String entityName, Object entity) Delete a row. | |
| get | back to summary |
|---|---|
| public Object get(String entityName, Serializable id) Retrieve a row.
| |
| get | back to summary |
|---|---|
| public Object get(Class<T> entityClass, Serializable id) Retrieve a row.
| |
| get | back to summary |
|---|---|
| public Object get(String entityName, Serializable id, LockMode lockMode) Retrieve a row, obtaining the specified lock mode.
| |
| get | back to summary |
|---|---|
| public Object get(Class<T> entityClass, Serializable id, LockMode lockMode) Retrieve a row, obtaining the specified lock mode.
| |
| getNamedQuery | back to summary |
|---|---|
| public Query getNamedQuery(String queryName) Obtain an instance of Query for a named query string defined in the mapping file. Entities returned by the query are detached. | |
| getTransaction | back to summary |
|---|---|
| public Transaction getTransaction() Get the current Hibernate transaction. | |
| insert | back to summary |
|---|---|
| public Serializable insert(Object entity) Insert a row.
| |
| insert | back to summary |
|---|---|
| public Serializable insert(String entityName, Object entity) Insert a row.
| |
| refresh | back to summary |
|---|---|
| public void refresh(Object entity) Refresh the entity instance state from the database.
| |
| refresh | back to summary |
|---|---|
| public void refresh(String entityName, Object entity) Refresh the entity instance state from the database. | |
| refresh | back to summary |
|---|---|
| public void refresh(Object entity, LockMode lockMode) Refresh the entity instance state from the database. | |
| refresh | back to summary |
|---|---|
| public void refresh(String entityName, Object entity, LockMode lockMode) Refresh the entity instance state from the database. | |
| update | back to summary |
|---|---|
| public void update(Object entity) Update a row.
| |
| update | back to summary |
|---|---|
| public void update(String entityName, Object entity) Update a row. | |