Hibernate的三个状态 方法列表
boolean | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#isConnected()"><font face="新宋体" color="#000080">isConnected</font></a></strong><font face="新宋体">()</font> 检查当前Session是否处于连接状态。 |
boolean | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#isDirty()"><font face="新宋体" color="#000080">isDirty</font></a></strong><font face="新宋体">()</font> 当前Session是否包含需要与数据库同步的(数据状态)变化 ?如果我们刷新提交(flush)这个session是否会有SQL执行? |
boolean | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#isOpen()"><font face="新宋体" color="#000080">isOpen</font></a></strong><font face="新宋体">()</font> 检查当前Session是否仍然打开。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable)"><font face="NSimsun" color="#000080">load</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Class.html"><font face="NSimsun" color="#000080">Class</font></a><font face="NSimsun"> theClass, </font><a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a><font face="NSimsun"> id)</font> 在符合条件的实例存在的情况下,根据给定的实体类和标识返回持久化状态的实例。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#load(java.lang.Class,%20java.io.Serializable,%20org.hibernate.LockMode)"><font face="NSimsun" color="#000080">load</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Class.html"><font face="NSimsun" color="#000080">Class</font></a><font face="NSimsun"> theClass, </font><a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a><font face="NSimsun"> id, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/LockMode.html"><font face="NSimsun" color="#000080">LockMode</font></a><font face="NSimsun"> lockMode)</font> 在符合条件的实例存在的情况下,根据给定的实体类、标识及指定的锁定等级返回持久化状态的实例。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#load(java.lang.Object,%20java.io.Serializable)"><font face="新宋体" color="#000080">load</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="新宋体" color="#000080">Serializable</font></a><font face="新宋体"> id)</font> 将与给定的标示对应的持久化状态(值)复制到给定的自由状态(trasient)实例上。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#load(java.lang.String,%20java.io.Serializable)"><font face="NSimsun" color="#000080">load</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="NSimsun" color="#000080">String</font></a><font face="NSimsun"> entityName, </font><a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a><font face="NSimsun"> id)</font> 在符合条件的实例存在的情况下,根据给定的实体类和标识返回持久化状态的实例。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#load(java.lang.String,%20java.io.Serializable,%20org.hibernate.LockMode)"><font face="NSimsun" color="#000080">load</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="NSimsun" color="#000080">String</font></a><font face="NSimsun"> entityName, </font><a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a><font face="NSimsun"> id, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/LockMode.html"><font face="NSimsun" color="#000080">LockMode</font></a><font face="NSimsun"> lockMode)</font> 在符合条件的实例存在的情况下,根据给定的实体类、标识及指定的锁定等级返回持久化状态的实例。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#lock(java.lang.Object,%20org.hibernate.LockMode)"><font face="新宋体" color="#000080">lock</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/LockMode.html"><font face="新宋体" color="#000080">LockMode</font></a><font face="新宋体"> lockMode)</font> 从给定的对象上获取指定的锁定级别。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#lock(java.lang.String,%20java.lang.Object,%20org.hibernate.LockMode)"><font face="新宋体" color="#000080">lock</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="新宋体" color="#000080">String</font></a><font face="新宋体"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/LockMode.html"><font face="新宋体" color="#000080">LockMode</font></a><font face="新宋体"> lockMode)</font> 从给定的对象上获取指定的锁定级别。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#merge(java.lang.Object)"><font face="NSimsun" color="#000080">merge</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a><font face="NSimsun"> object)</font> 将给定的对象的状态复制到具有相同标识的持久化对象上。 |
<a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#merge(java.lang.String,%20java.lang.Object)"><font face="NSimsun" color="#000080">merge</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="NSimsun" color="#000080">String</font></a><font face="NSimsun"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a><font face="NSimsun"> object)</font> 将给定的对象的状态复制到具有相同标识的持久化对象上。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#persist(java.lang.Object)"><font face="新宋体" color="#000080">persist</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 将一个自由状态(transient)的实例持久化。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#persist(java.lang.String,%20java.lang.Object)"><font face="新宋体" color="#000080">persist</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="新宋体" color="#000080">String</font></a><font face="新宋体"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 将一个自由状态(transient)的实例持久化。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#reconnect(java.sql.Connection)"><font face="新宋体" color="#000080">reconnect</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.sql" href="http://java.sun.com/j2se/1.3/docs/api/java/sql/Connection.html"><font face="新宋体" color="#000080">Connection</font></a><font face="新宋体"> connection)</font> 重新连接到给定的JDBC连接。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#refresh(java.lang.Object)"><font face="新宋体" color="#000080">refresh</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 从数据库中重新读取给定实例的状态。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#refresh(java.lang.Object,%20org.hibernate.LockMode)"><font face="新宋体" color="#000080">refresh</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/LockMode.html"><font face="新宋体" color="#000080">LockMode</font></a><font face="新宋体"> lockMode)</font> 根据指定的锁定模式(LockMode),从数据库中重新读取给定实例的状态。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#replicate(java.lang.Object,%20org.hibernate.ReplicationMode)"><font face="新宋体" color="#000080">replicate</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/ReplicationMode.html"><font face="新宋体" color="#000080">ReplicationMode</font></a><font face="新宋体"> replicationMode)</font> 使用当前的标识值持久化给定的游离状态(Transient)的实体。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#replicate(java.lang.String,%20java.lang.Object,%20org.hibernate.ReplicationMode)"><font face="新宋体" color="#000080">replicate</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="新宋体" color="#000080">String</font></a><font face="新宋体"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object, </font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/ReplicationMode.html"><font face="新宋体" color="#000080">ReplicationMode</font></a><font face="新宋体"> replicationMode)</font> 使用当前的标识值持久化给定的游离状态(Transient)的实体。 |
<a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#save(java.lang.Object)"><font face="NSimsun" color="#000080">save</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a><font face="NSimsun"> object)</font> 首先为给定的自由状态(Transient)的对象(根据配置)生成一个标识并赋值,然后将其持久化。 |
<a title="class or interface in java.io" href="http://java.sun.com/j2se/1.3/docs/api/java/io/Serializable.html"><font face="NSimsun" color="#000080">Serializable</font></a> | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#save(java.lang.String,%20java.lang.Object)"><font face="NSimsun" color="#000080">save</font></a></strong><font face="NSimsun">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="NSimsun" color="#000080">String</font></a><font face="NSimsun"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="NSimsun" color="#000080">Object</font></a><font face="NSimsun"> object)</font> 首先为给定的自由状态(Transient)的对象(根据配置)生成一个标识并赋值,然后将其持久化。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#saveOrUpdate(java.lang.Object)"><font face="新宋体" color="#000080">saveOrUpdate</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 根据给定的实例的标识属性的值(注:可以指定unsaved-value。一般默认null。)来决定执行 save() 或update()操作。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#saveOrUpdate(java.lang.String,%20java.lang.Object)"><font face="新宋体" color="#000080">saveOrUpdate</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="新宋体" color="#000080">String</font></a><font face="新宋体"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 根据给定的实例的标识属性的值(注:可以指定unsaved-value。一般默认null。)来决定执行 save() 或update()操作。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#setCacheMode(org.hibernate.CacheMode)"><font face="新宋体" color="#000080">setCacheMode</font></a></strong><font face="新宋体">(</font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/CacheMode.html"><font face="新宋体" color="#000080">CacheMode</font></a><font face="新宋体"> cacheMode)</font> 设置刷新提交模式。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#setFlushMode(org.hibernate.FlushMode)"><font face="新宋体" color="#000080">setFlushMode</font></a></strong><font face="新宋体">(</font><a title="class in org.hibernate" href="http://www.blogjava.net/org/hibernate/FlushMode.html"><font face="新宋体" color="#000080">FlushMode</font></a><font face="新宋体"> flushMode)</font> 设置刷新提交模式。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#setReadOnly(java.lang.Object,%20boolean)"><font face="新宋体" color="#000080">setReadOnly</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> entity, boolean readOnly)</font> 将一个未经更改的持久化对象设置为只读模式,或者将一个只读对象标记为可以修改的模式。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#update(java.lang.Object)"><font face="新宋体" color="#000080">update</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 根据给定的detached(游离状态)对象实例的标识更新对应的持久化实例。 |
void | <strong><a href="http://www.blogjava.net/org/hibernate/Session.html#update(java.lang.String,%20java.lang.Object)"><font face="新宋体" color="#000080">update</font></a></strong><font face="新宋体">(</font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html"><font face="新宋体" color="#000080">String</font></a><font face="新宋体"> entityName, </font><a title="class or interface in java.lang" href="http://java.sun.com/j2se/1.3/docs/api/java/lang/Object.html"><font face="新宋体" color="#000080">Object</font></a><font face="新宋体"> object)</font> 根据给定的detached(游离状态)对象实例的标识更新对应的持久化实例 |
- Hibernate的三个状态(1)
- 扩展hibernate的查询
- 简单的Hibernate入门介绍
- 在Liferay中使用Hibernate
- Hibernate的三个状态(2)
相关推荐
IT之家 2020-03-11
graseed 2020-10-28
zbkyumlei 2020-10-12
SXIAOYI 2020-09-16
jinhao 2020-09-07
impress 2020-08-26
liuqipao 2020-07-07
淡风wisdon大大 2020-06-06
yoohsummer 2020-06-01
chenjia00 2020-05-29
baike 2020-05-19
扭来不叫牛奶 2020-05-08
hxmilyy 2020-05-11
黎豆子 2020-05-07
xiongweiwei00 2020-04-29
Cypress 2020-04-25
冰蝶 2020-04-20