Java Doc for Session.java in  » Database-ORM » hibernate » org » hibernate » classic » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » hibernate » org.hibernate.classic 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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  QuerycreateSQLQuery(String sql, String returnAlias, Class returnClass)
     Create a new instance of Query for the given SQL string.
public  QuerycreateSQLQuery(String sql, String[] returnAliases, Class[] returnClasses)
     Create a new instance of Query for the given SQL string.
public  intdelete(String query)
     Delete all objects returned by the query.
public  intdelete(String query, Object value, Type type)
     Delete all objects returned by the query.
public  intdelete(String query, Object[] values, Type[] types)
     Delete all objects returned by the query.
public  Collectionfilter(Object collection, String filter)
     Apply a filter to a persistent collection.
public  Collectionfilter(Object collection, String filter, Object value, Type type)
     Apply a filter to a persistent collection.
public  Collectionfilter(Object collection, String filter, Object[] values, Type[] types)
     Apply a filter to a persistent collection. Bind the given parameters to "?" placeholders.
public  Listfind(String query)
     Execute a query.
public  Listfind(String query, Object value, Type type)
     Execute a query with bind parameters, binding a value to a "?" parameter in the query string.
public  Listfind(String query, Object[] values, Type[] types)
     Execute a query with bind parameters, binding an array of values to "?" parameters in the query string.
public  Iteratoriterate(String query)
     Execute a query and return the results in an iterator.
public  Iteratoriterate(String query, Object value, Type type)
     Execute a query and return the results in an iterator.
public  Iteratoriterate(String query, Object[] values, Type[] types)
     Execute a query and return the results in an iterator.
public  voidsave(Object object, Serializable id)
     Persist the given transient instance, using the given identifier.
public  voidsave(String entityName, Object object, Serializable id)
     Persist the given transient instance, using the given identifier.
public  ObjectsaveOrUpdateCopy(Object object)
     Copy the state of the given object onto the persistent object with the same identifier.
public  ObjectsaveOrUpdateCopy(Object object, Serializable id)
     Copy the state of the given object onto the persistent object with the given identifier.
public  ObjectsaveOrUpdateCopy(String entityName, Object object)
     Copy the state of the given object onto the persistent object with the same identifier.
public  ObjectsaveOrUpdateCopy(String entityName, Object object, Serializable id)
     Copy the state of the given object onto the persistent object with the given identifier.
public  voidupdate(Object object, Serializable id)
     Update the persistent state associated with the given identifier.
public  voidupdate(String entityName, Object object, Serializable id)
     Update the persistent state associated with the given identifier.



Method Detail
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 value, Type type) throws HibernateException(Code)
Apply a filter to a persistent collection. 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:
  value - a value to be witten to a "?" placeholder in the query string
Parameters:
  type - the hibernate type of value 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 -



find
public List find(String query) throws HibernateException(Code)
Execute a query. Session.createQueryQuery.list
Parameters:
  query - a query expressed in Hibernate's query language a distinct list of instances (or arrays of instances)
throws:
  HibernateException -



find
public List find(String query, Object value, Type type) throws HibernateException(Code)
Execute a query with bind parameters, binding a value to a "?" parameter in the query string. Session.createQueryQuery.list
Parameters:
  query - the query string
Parameters:
  value - a value to be bound to a "?" placeholder (JDBC IN parameter).
Parameters:
  type - the Hibernate type of the value
See Also:   org.hibernate.Hibernate
See Also:    for access to Type instances a distinct list of instances (or arrays of instances)
throws:
  HibernateException -



find
public List find(String query, Object[] values, Type[] types) throws HibernateException(Code)
Execute a query with bind parameters, binding an array of values to "?" parameters in the query string. Session.createQueryQuery.list
Parameters:
  query - the query string
Parameters:
  values - an array of values to be bound to the "?" placeholders (JDBC IN parameters).
Parameters:
  types - an array of Hibernate types of the values
See Also:   org.hibernate.Hibernate
See Also:    for access to Type instances a distinct list of instances
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 -



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.