关于Hibernate的2个Session-1

 


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抽象的概念,持续的服务。

 

生命周期的会话范围内的开始和结束的一个逻辑的事务。 (长时间的事务可能是跨越几个数据库的事务。 )

 

其主要职能是提供会话创建,读取和删除操作的情况下的映射实体类。情况下可能存在的三个状态之一:

 

瞬态:永远持续,而不是与任何一会话关联

持久状态:一个独特的相关会话

死亡状态:以前持续,而不是与任何一会话

 

 QuerycreateQuery(String queryString)
          Create a new instance of Query for the given HQL query string.
 SQLQuerycreateSQLQuery(String queryString)
          Create a new instance of SQLQuery for the given SQL query string.
 voiddelete(Object object)
          Remove a persistent instance from the datastore.
 voiddelete(String entityName, Object object)

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值