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. Finalize方法的生成

    Finalize在c#编程语言中需要特殊语法,因此,c#要求在类名前加~符号来定义Finalize方法:例如 internal class FinalizeDemo { ~FinalizeDemo() ...

  2. Spring的bean管理(注解方式)

    注解:代码中的特殊标记,注解可以使用在类.方法.属性上面,使用注解可实现一些基本的功能.注解的写法是@注解名称(属性=属性值). 使用注解创建对象 第一步,创建Web项目,引入Spring的开发包 第 ...

  3. 浅谈Java中的关键字

    谈到final关键字,想必很多人都不陌生,在使用匿名内部类的时候可能会经常用到final关键字.另外,Java中的String类就是一个final类,那么今天我们就来了解final这个关键字的用法. ...

  4. mssql卸载后重新安装 错误解决

    1.instance id already in use http://www.sqlservercentral.com/articles/MSSQLSERVER/161398/ 2.提示没有重启 删 ...

  5. 使用jfreechart生成柱状图、折线图、和饼状图

    JFreeChart是JAVA平台上的一个开放的图表绘制类库.它完全使用JAVA语言编写,是为applications, applets, servlets 以及JSP等使用所设计.下面我就详细介绍如 ...

  6. Hbase 读写 原理

    客户端读取信息流程 ()client要读取信息,先查询下client 端的cache中是否存在数据,如果存在,刚直接返回数据.如果不存在,则进入到zookeeper,查找到里面的相应数据存在的Root ...

  7. SV coverage

    covergroup是对coverage model的一种包装,每个covergroup可以包含: 1) sync event来触发采样, 2) 很多coverpoint, 3) cross cove ...

  8. PHP插入数据库代码,编辑,删除

    插入代码 $action=$_GET['action']; switch($action){ //添加记录 case"add"; $mail = trim(htmlspecialc ...

  9. Ubuntu编译Android源码步骤

    Android4.4源码编译 需要准备以下文件: 源码包名:x4412_kitkat_rtm.tar.bz2 Jdk版本为jdk1.6.0_27 gcc 4.4 g++ 4.4 第一步:安装Ubunt ...

  10. Class_fifth

    1,统计文件夹的文件总数 代码: package Class_fifth; import java.io.File; public class Statistics { public static v ...