自己理解,不完全正确,大致如下:
例:某实体类 Person(int id,string name,int age); id 为主键。
新建:new Person(), 并且未给 id 赋值;
游离:new Person(), 并且给 id 赋值;或者数据库获取的Person 类实例,然后关闭了session;
持久化:从数据库获取的Person 类实例;
删除:
参考:
https://blog.csdn.net/yingxiake/article/details/50968059
四种状态总结:
状态名 作为java对象存在 在实体管理器中存在 在数据库存在
New yes no no
Managed yes yes yes
Detached no no no
Removed yes yes no
---------------------
作者:node2017
来源:CSDN
原文:https://blog.csdn.net/yingxiake/article/details/50968059
版权声明:本文为博主原创文章,转载请附上博文链接!