| org.hibernate.classic.Session
All known Subclasses: org.hibernate.impl.SessionImpl,
Session | public interface Session extends org.hibernate.Session(Code) | | An extension of the Session API, including all
deprecated methods from Hibernate2. This interface is
provided to allow easier migration of existing applications.
New code should use org.hibernate.Session.
author: Gavin King |
Method Summary | |
public Query | createSQLQuery(String sql, String returnAlias, Class returnClass) Create a new instance of Query for the given SQL string. | public Query | createSQLQuery(String sql, String[] returnAliases, Class[] returnClasses) Create a new instance of Query for the given SQL string. | public int | delete(String query) Delete all objects returned by the query. | public int | delete(String query, Object value, Type type) Delete all objects returned by the query. | public int | delete(String query, Object[] values, Type[] types) Delete all objects returned by the query. | public Collection | filter(Object collection, String filter) Apply a filter to a persistent collection. | public Collection | filter(Object collection, String filter, Object value, Type type) Apply a filter to a persistent collection. | public Collection | filter(Object collection, String filter, Object[] values, Type[] types) Apply a filter to a persistent collection.
Bind the given parameters to "?" placeholders. | public List | find(String query) Execute a query. | public List | find(String query, Object value, Type type) Execute a query with bind parameters, binding a value to a "?" parameter
in the query string. | public List | find(String query, Object[] values, Type[] types) Execute a query with bind parameters, binding an array of values to "?"
parameters in the query string. | public Iterator | iterate(String query) Execute a query and return the results in an iterator. | public Iterator | iterate(String query, Object value, Type type) Execute a query and return the results in an iterator. | public Iterator | iterate(String query, Object[] values, Type[] types) Execute a query and return the results in an iterator. | public void | save(Object object, Serializable id) Persist the given transient instance, using the given identifier. | public void | save(String entityName, Object object, Serializable id) Persist the given transient instance, using the given identifier. | public Object | saveOrUpdateCopy(Object object) Copy the state of the given object onto the persistent object with the same
identifier. | public Object | saveOrUpdateCopy(Object object, Serializable id) Copy the state of the given object onto the persistent object with the
given identifier. | public Object | saveOrUpdateCopy(String entityName, Object object) Copy the state of the given object onto the persistent object with the same
identifier. | public Object | saveOrUpdateCopy(String entityName, Object object, Serializable id) Copy the state of the given object onto the persistent object with the
given identifier. | public void | update(Object object, Serializable id) Update the persistent state associated with the given identifier. | public void | update(String entityName, Object object, Serializable id) Update the persistent state associated with the given identifier. |
createSQLQuery | public Query createSQLQuery(String sql, String returnAlias, Class returnClass)(Code) | | Create a new instance of Query for the given SQL string.
Parameters: sql - a query expressed in SQL Parameters: returnAlias - a table alias that appears inside {} in the SQL string Parameters: returnClass - the returned persistent class |
createSQLQuery | public Query createSQLQuery(String sql, String[] returnAliases, Class[] returnClasses)(Code) | | Create a new instance of Query for the given SQL string.
Parameters: sql - a query expressed in SQL Parameters: returnAliases - an array of table aliases that appear inside {} in the SQL string Parameters: returnClasses - the returned persistent classes |
delete | public int delete(String query) throws HibernateException(Code) | | Delete all objects returned by the query. Return the number of objects deleted.
Note that this is very different from the delete-statement support added in HQL
since 3.1. The functionality here is to actually peform the query and then iterate
the results calling
Session.delete(Object) individually.
Parameters: query - the query string the number of instances deleted throws: HibernateException - |
delete | public int delete(String query, Object value, Type type) throws HibernateException(Code) | | Delete all objects returned by the query. Return the number of objects deleted.
Note that this is very different from the delete-statement support added in HQL
since 3.1. The functionality here is to actually peform the query and then iterate
the results calling
Session.delete(Object) individually.
Parameters: query - the query string Parameters: value - a value to be witten to a "?" placeholder in the query string. Parameters: type - the hibernate type of value. the number of instances deleted throws: HibernateException - |
delete | public int delete(String query, Object[] values, Type[] types) throws HibernateException(Code) | | Delete all objects returned by the query. Return the number of objects deleted.
Note that this is very different from the delete-statement support added in HQL
since 3.1. The functionality here is to actually peform the query and then iterate
the results calling
Session.delete(Object) individually.
Parameters: query - the query string Parameters: values - a list of values to be written to "?" placeholders in the query. Parameters: types - a list of Hibernate types of the values the number of instances deleted throws: HibernateException - |
filter | public Collection filter(Object collection, String filter) throws HibernateException(Code) | | Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to
this, the collection element. Filters allow efficient access to very large lazy
collections. (Executing the filter does not initialize the collection.)
Session.createFilter(Object,String)Query.list Parameters: collection - a persistent collection to filter Parameters: filter - a filter query string Collection the resulting collection throws: HibernateException - |
filter | public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws HibernateException(Code) | | Apply a filter to a persistent collection.
Bind the given parameters to "?" placeholders. A filter is a Hibernate query that
may refer to this, the collection element.
Session.createFilter(Object,String)Query.list Parameters: collection - a persistent collection to filter Parameters: filter - a filter query string Parameters: values - a list of values to be written to "?" placeholders in the query Parameters: types - a list of Hibernate types of the values Collection throws: HibernateException - |
iterate | public Iterator iterate(String query) throws HibernateException(Code) | | Execute a query and return the results in an iterator. If the query has multiple
return values, values will be returned in an array of type Object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So iterate() is usually a less efficient way to retrieve
objects than find().
Session.createQueryQuery.iterate Parameters: query - the query string an iterator throws: HibernateException - |
iterate | public Iterator iterate(String query, Object value, Type type) throws HibernateException(Code) | | Execute a query and return the results in an iterator. Write the given value to "?"
in the query string. If the query has multiple return values, values will be returned
in an array of type Object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So iterate() is usually a less efficient way to retrieve
objects than find().
Session.createQueryQuery.iterate Parameters: query - the query string Parameters: value - a value to be witten to a "?" placeholder in the query string Parameters: type - the hibernate type of value an iterator throws: HibernateException - |
iterate | public Iterator iterate(String query, Object[] values, Type[] types) throws HibernateException(Code) | | Execute a query and return the results in an iterator. Write the given values to "?"
in the query string. If the query has multiple return values, values will be returned
in an array of type Object[].
Entities returned as results are initialized on demand. The first SQL query returns
identifiers only. So iterate() is usually a less efficient way to retrieve
objects than find().
Session.createQueryQuery.iterate Parameters: query - the query string Parameters: values - a list of values to be written to "?" placeholders in the query Parameters: types - a list of Hibernate types of the values an iterator throws: HibernateException - |
save | public void save(Object object, Serializable id) throws HibernateException(Code) | | Persist the given transient instance, using the given identifier. This operation
cascades to associated instances if the association is mapped with
cascade="save-update".
Parameters: object - a transient instance of a persistent class Parameters: id - an unused valid identifier throws: HibernateException - |
save | public void save(String entityName, Object object, Serializable id) throws HibernateException(Code) | | Persist the given transient instance, using the given identifier. This operation
cascades to associated instances if the association is mapped with
cascade="save-update".
Parameters: object - a transient instance of a persistent class Parameters: id - an unused valid identifier throws: HibernateException - |
saveOrUpdateCopy | public Object saveOrUpdateCopy(Object object) throws HibernateException(Code) | | Copy the state of the given object onto the persistent object with the same
identifier. If there is no persistent instance currently associated with
the session, it will be loaded. Return the persistent instance. If the
given instance is unsaved or does not exist in the database, save it and
return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
org.hibernate.Session.merge(Object) Parameters: object - a transient instance with state to be copied an updated persistent instance |
saveOrUpdateCopy | public Object saveOrUpdateCopy(Object object, Serializable id) throws HibernateException(Code) | | Copy the state of the given object onto the persistent object with the
given identifier. If there is no persistent instance currently associated
with the session, it will be loaded. Return the persistent instance. If
there is no database row with the given identifier, save the given instance
and return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
Parameters: object - a persistent or transient instance with state to be copied Parameters: id - the identifier of the instance to copy to an updated persistent instance |
saveOrUpdateCopy | public Object saveOrUpdateCopy(String entityName, Object object) throws HibernateException(Code) | | Copy the state of the given object onto the persistent object with the same
identifier. If there is no persistent instance currently associated with
the session, it will be loaded. Return the persistent instance. If the
given instance is unsaved or does not exist in the database, save it and
return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
org.hibernate.Session.merge(StringObject) Parameters: object - a transient instance with state to be copied an updated persistent instance |
saveOrUpdateCopy | public Object saveOrUpdateCopy(String entityName, Object object, Serializable id) throws HibernateException(Code) | | Copy the state of the given object onto the persistent object with the
given identifier. If there is no persistent instance currently associated
with the session, it will be loaded. Return the persistent instance. If
there is no database row with the given identifier, save the given instance
and return it as a newly persistent instance. Otherwise, the given instance
does not become associated with the session.
Parameters: object - a persistent or transient instance with state to be copied Parameters: id - the identifier of the instance to copy to an updated persistent instance |
update | public void update(Object object, Serializable id) throws HibernateException(Code) | | Update the persistent state associated with the given identifier. An exception
is thrown if there is a persistent instance with the same identifier in the
current session. This operation cascades to associated instances
if the association is mapped with cascade="save-update".
Parameters: object - a detached instance containing updated state Parameters: id - identifier of persistent instance throws: HibernateException - |
update | public void update(String entityName, Object object, Serializable id) throws HibernateException(Code) | | Update the persistent state associated with the given identifier. An exception
is thrown if there is a persistent instance with the same identifier in the
current session. This operation cascades to associated instances
if the association is mapped with cascade="save-update".
Parameters: object - a detached instance containing updated state Parameters: id - identifier of persistent instance throws: HibernateException - |
|
|