---
title: "Hiberante part 6：持久化对象状态"
author: "mvplee"
date: "2015-02-21T13:34:30Z"
tags: []
categories: ["企业架构"]
slug: "hiberante-part-6"
draft: false
lastmod: "2015-02-21T13:32:53Z"
id: 2186396
url: "https://mvplee.iteye.com/blog/2186396"
---

**瞬时态 transient：**

尚未与Hibernate Session关联对象，被认为处于瞬时状态，失去引用将被JVM回收,无持久化标识OID，未与Session关联  
**持久态 persistent：**

数据库中有数据与之对应并与当前session有关联，并且相关联的session没有关闭数据库并且事务未提交,存在持久化标识OID，与Session关联  
**脱管态 detached：**

数据库中有数据与之对应，但当前没有session与之关联，脱管状态改变hibernate不能检测到,存在持久化标识OID，未与Session关联

 

![](http://dl2.iteye.com/upload/attachment/0106/1380/a8df34d7-9d55-3616-9a98-2764ba0a0230.png)  
 

 

这张图片来源于网络，只不忘了出处，当时认为这张图比Hibernate文档里的那张要好，因为有颜色  
![](http://dl2.iteye.com/upload/attachment/0106/1382/8a87e300-a68d-3778-b063-ed38d8eabef1.png)