FileDocCategorySizeDatePackage
StatelessSession.javaAPI DocHibernate 3.2.56081Tue Mar 28 13:59:32 BST 2006org.hibernate

StatelessSession

public interface StatelessSession implements Serializable
A command-oriented API for performing bulk operations against a database.

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.
author
Gavin King

Fields Summary
Constructors Summary
Methods Summary
public TransactionbeginTransaction()
Begin a Hibernate transaction.

public voidclose()
Close the stateless session and release the JDBC connection.

public java.sql.Connectionconnection()
Returns the current JDBC connection associated with this instance.

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.

public CriteriacreateCriteria(java.lang.Class 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.

param
persistentClass a class, which is persistent, or has persistent subclasses
return
Criteria

public CriteriacreateCriteria(java.lang.Class persistentClass, java.lang.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.

param
persistentClass a class, which is persistent, or has persistent subclasses
return
Criteria

public CriteriacreateCriteria(java.lang.String entityName)
Create a new Criteria instance, for the given entity name. Entities returned by the query are detached.

param
entityName
return
Criteria

public CriteriacreateCriteria(java.lang.String entityName, java.lang.String alias)
Create a new Criteria instance, for the given entity name, with the given alias. Entities returned by the query are detached.

param
entityName
return
Criteria

public QuerycreateQuery(java.lang.String queryString)
Create a new instance of Query for the given HQL query string. Entities returned by the query are detached.

public SQLQuerycreateSQLQuery(java.lang.String queryString)
Create a new instance of SQLQuery for the given SQL query string. Entities returned by the query are detached.

param
queryString a SQL query
return
SQLQuery
throws
HibernateException

public voiddelete(java.lang.Object entity)
Delete a row.

param
entity a detached entity instance

public voiddelete(java.lang.String entityName, java.lang.Object entity)
Delete a row.

param
entityName The entityName for the entity to be deleted
param
entity a detached entity instance

public java.lang.Objectget(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.

return
a detached entity instance

public java.lang.Objectget(java.lang.Class entityClass, java.io.Serializable id, LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.

return
a detached entity instance

public java.lang.Objectget(java.lang.String entityName, java.io.Serializable id)
Retrieve a row.

return
a detached entity instance

public java.lang.Objectget(java.lang.Class entityClass, java.io.Serializable id)
Retrieve a row.

return
a detached entity instance

public QuerygetNamedQuery(java.lang.String queryName)
Obtain an instance of Query for a named query string defined in the mapping file. Entities returned by the query are detached.

public TransactiongetTransaction()
Get the current Hibernate transaction.

public java.io.Serializableinsert(java.lang.Object entity)
Insert a row.

param
entity a new transient instance

public java.io.Serializableinsert(java.lang.String entityName, java.lang.Object entity)
Insert a row.

param
entityName The entityName for the entity to be inserted
param
entity a new transient instance
return
the identifier of the instance

public voidrefresh(java.lang.Object entity)
Refresh the entity instance state from the database.

param
entity The entity to be refreshed.

public voidrefresh(java.lang.String entityName, java.lang.Object entity)
Refresh the entity instance state from the database.

param
entityName The entityName for the entity to be refreshed.
param
entity The entity to be refreshed.

public voidrefresh(java.lang.Object entity, LockMode lockMode)
Refresh the entity instance state from the database.

param
entity The entity to be refreshed.
param
lockMode The LockMode to be applied.

public voidrefresh(java.lang.String entityName, java.lang.Object entity, LockMode lockMode)
Refresh the entity instance state from the database.

param
entityName The entityName for the entity to be refreshed.
param
entity The entity to be refreshed.
param
lockMode The LockMode to be applied.

public voidupdate(java.lang.Object entity)
Update a row.

param
entity a detached entity instance

public voidupdate(java.lang.String entityName, java.lang.Object entity)
Update a row.

param
entityName The entityName for the entity to be updated
param
entity a detached entity instance