org.hibernate
Interface Session
-
All Superinterfaces:
- Serializable
-
All Known Subinterfaces:
- EventSource, Session
-
All Known Implementing Classes:
- SessionImpl
The main runtime interface between a Java application and Hibernate. This is the central API class abstracting the notion of a persistence service.
The lifecycle of a Session is bounded by the beginning and end of a logical transaction. (Long transactions might span several database transactions.)
The main function of the Session is to offer create, read and delete operations for instances of mapped entity classes. Instances may exist in one of three states:
transient: never persistent, not associated with any Session
persistent: associated with a unique Session
detached: previously persistent, not associated with any Session
这是Hibernate和Java应用程序交互的主要接口。它是核心级的API抽象的概念,持续的服务。
生命周期的会话范围内的开始和结束的一个逻辑的事务。 (长时间的事务可能是跨越几个数据库的事务。 )
其主要职能是提供会话创建,读取和删除操作的情况下的映射实体类。情况下可能存在的三个状态之一:
瞬态:永远持续,而不是与任何一会话关联
持久状态:一个独特的相关会话
死亡状态:以前持续,而不是与任何一会话
Query | createQuery(String queryString) Create a new instance of Query for the given HQL query string. |
SQLQuery | createSQLQuery(String queryString) Create a new instance of SQLQuery for the given SQL query string. |
void | delete(Object object) Remove a persistent instance from the datastore. |
void | delete(String entityName, Object object) |