Persistence contexts

org.hibernate.Session API and javax.persistence.EntityManager API represent a context for dealing with persistent data. This concept is called  apersistencec context. Persistent data has a state in relation to both a persistence context and the underlying database.

transient瞬时

The entity has just been instantiated and is not assocaiated with a persistence context.

It has no persistent representation in the database and typically no identifier value has been assigned(unless the assigned generator was used).

managed, or persistent 持久的]

实体有一个关联的标识符,并且和持久化上下文关联.

物理地存在或者不存在于数据库中.

detached 托管的,游离的

有关联的标识符,但是不再和持久化上下滑关联(通常因为持久化上下文被关闭或者实例被上下文清除.

removed

实体有关联的标识符并且和持久化上下文关联,然而它被计划从数据库中移除.

大多数org.hibernate.Session API and javax.persistence.EntityManager API的方法处理实体在这些状态之间的变动.

-------------从JPA中访问Hibernate APIs--------

Session session = entityManager.unwrap( Session.class );
SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class ); SessionFactory sessionFactory = entityManager.getEntityManagerFactory().unwrap( SessionFactory.class );
----------------

[Hibernate] official tutorial - userguide的更多相关文章

  1. [转载] CMake Official Tutorial——教程还是官方的好

    CMake官方教程传送门:https://cmake.org/cmake-tutorial/ 以下的内容跟官方教程基本一致,少数地方根据自己的测试有所改动: A Basic Starting Poin ...

  2. ROS->The Official Tutorial

    系统安装 我的使用环境是Ubuntu 16.04LTS 32bit # deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (2016 ...

  3. MySQL official tutorial

    1.installation 2.setup environment variables add %/MySQL Server/bin to path. then restart cmd/powers ...

  4. TensorFlow tutorial

    代码示例来自https://github.com/aymericdamien/TensorFlow-Examples tensorflow先定义运算图,在run的时候才会进行真正的运算. run之前需 ...

  5. Tutorial: Reverse debugging with GDB 7 (转载)

    Tutorial: Reverse debugging with GDB 7 Tutorial: Reverse debugging with GDB 7 by Jay Conrod posted o ...

  6. JPA、Hibernate、Spring-Data-Jpa的本质区别

    什么是JPA? 全称Java Persistence API,可以通过注解或者XML描述[对象-关系表]之间的映射关系,并将实体对象持久化到数据库中. 为我们提供了: 1)ORM映射元数据:JPA支持 ...

  7. Excellent Articles

    Lisp The roots of lisp Recursive Functions of Symbolic Expressions and Their Computation by Machine, ...

  8. MyBlog

    2016-06-25 一直想在搭建一个自己的blog.说来惭愧,cnblogs中的个人博客虽笔耕不辍,但杂乱无章.然而之前总是嘴上说说.现在,终于要行动起来了. 初步计划: 思路: django + ...

  9. Node.js 入门手册:那些最流行的 Web 开发框架

    这篇文章与大家分享最流行的 Node.js Web 开发框架.Node 是一个服务器端 JavaScript 解释器,它将改变服务器应该如何工作的概念.它的目标是帮助程序员构建高度可伸缩的应用程序,编 ...

随机推荐

  1. Gym 102028C - Supreme Command - [思维题][2018-2019 ACM-ICPC Asia Jiaozuo Regional Contest Problem C]

    题目链接:https://codeforces.com/gym/102028/problem/C Lewis likes playing chess. Now he has n rooks on th ...

  2. iOS NSCache缓存类的了解

    前言:   最近面试时,问到了限定并发数的视频下载,当时回答的时通过GCD_barrier 处理,回来想想也可以通过NSCache处理,所以顺便复习一下,这个知识点. 一,关于NSCache说明 说明 ...

  3. python摸爬滚打之day18----instance, type, issubclass和反射

    1.issubclass(a,b)  ----> 判断a是否是b的子类.  isinstance(a,b)  ----> 判断a这个对象是否是b类型的(可以向上判断, 即考虑继承关系往父类 ...

  4. (备忘)怎么去除WinRAR弹窗广告?

    1.在WinRAR的安装目录下新建一个记事本,命名为“rarreg.key”. 2.打开记事本,将一下内容复制进去. RAR registration data Federal Agency for ...

  5. Redis的数据结构之字符串

    五种数据类型: 字符串(String) 字符串列表(list) 有序字符串集合(sorted set) 哈希(hash) 字符串集合(set) Key定义的注意点: 不要过长, 不要过短, 统一的命名 ...

  6. 腾讯TBS加载网页无法自适应记录

    1.  所遇到的问题 webview加载指定网页无法实现自适应,之前在加载重构一个网页的时候,其实也遇到这种问题,然后就有了下面的一下步骤 WebSettings webSettings = view ...

  7. Yii2 mongoDb的配置及使用

    yii2 的配置都是在启动时加载的,所以mongo的配置也同样在component里面配置. 具体实现(无用户和密码): [ 'mongo1' => [ 'class' => '\yii\ ...

  8. 关于mongodb基础的命令

    banji----数据库 class---集合 1.查看所在的数据库 db 2.查看所有的数据库 show dbs 3.创建数据库 use banji #查看所有的数据库show dbs,创建的数据库 ...

  9. Netty返回数据丢包的问题之一

    这个问题是在一个群友做压力测试的时候发现的.使用客户端和netty创建一条连接,然后写了一个for循环不停的给服务器发送1500条信息,发现返回只有几百条.另外几百条不知道哪去了.查看代码,发现在服务 ...

  10. JDK安装与配置(Windows 7系统)

    1.前言 安装之前需弄清JDK.JRE.JVM这几个概念,不然稀里糊涂不知道自己在装什么. (1)什么是java环境:我们知道,想听音乐就要安装音乐播放器,想看图片需要安装图片浏览器,同样道理,要运行 ...