关于hibernate session中的三个状态
来源:互联网 发布:ubuntu 15.10 更新源 编辑:程序博客网 时间:2024/05/21 10:14
org.hibernate
Interface Session
- All Superinterfaces:
- Serializable
- All Known Subinterfaces:
- EventSource, Session
- All Known Implementing Classes:
- SessionImpl
- public interface Session
- extends Serializable
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
Transient instances may be made persistent by calling save(), persist() or saveOrUpdate(). Persistent instances may be made transient by calling delete(). Any instance returned by a get() or load() method is persistent. Detached instances may be made persistent by calling update(), saveOrUpdate(), lock() or replicate(). The state of a transient or detached instance may also be made persistent as a new persistent instance by calling merge().
save() and persist() result in an SQL INSERT, delete() in an SQL DELETE and update() or merge() in an SQL UPDATE. Changes to persistent instances are detected at flush time and also result in an SQL UPDATE. saveOrUpdate() and replicate() result in either an INSERT or an UPDATE.
It is not intended that implementors be threadsafe. Instead each thread/transaction should obtain its own instance from a SessionFactory.
A Session instance is serializable if its persistent classes are serializable.
通过以上的描述,我们可以得出如下三种状态关系图
Transient 瞬时态
Persistent 持久态
Detached 游离态
- 关于hibernate session中的三个状态
- hibernate中的session以及三种状态
- hibernate的三个状态
- Hibernate初学者---关于Session和它的三种状态
- hibernate 数据的三个状态
- Hibernate中的三个异常
- Java Hibernate之Session状态
- 关于Hibernate的Session
- 关于hibernate session
- 关于 hibernate三个小问题
- hibernate管理实体的三个状态
- Hibernate持久化对象的三个状态
- hibernate持久化对象的三个状态
- Hibernate持久化对象的三个状态
- Hibernate中的Session管理
- Hibernate中的Session管理
- hibernate中的Session.flush()
- Hibernate中的Session
- Hibernate 之QBC
- 北大青鸟S1的C语言项目(学员管理系统)
- 一款不错的图像处理软件(含源码)
- 十分钟经济学:让你看懂中国经济形势
- WebService同步两台远程SQLSERVER2000数据库
- 关于hibernate session中的三个状态
- Helix Server和RealProducer Plus 的直播设置
- 流媒体的一些基础知识
- helix server忘了管理密码的处理办法
- javadoc怎么提取java注释
- helix server v11 绑定ip设置
- helix server V11 延迟关机以及相关设置
- 关于电影服务器带来的UDP攻击
- Ubuntu中文字体,输入法,播放rmvb等等问题一次性解决