Hibernate ORM 5.4.0.CR1 发布,数据持久层框架

栏目: Hibernate · 发布时间: 7年前

内容简介:Hibernate ORM 5.4.0 的第一个候选版本已发布。JPA 的 EntityGraph 功能定义和使用起来很麻烦。Hibernate ORM 5.4 增加了2个新功能,可帮助您更轻松地使用 EntityGraphs。请注意,所有这些改进都被视为孵化阶段。第一个功能是能够从 String 创建图形。例如,给定一个 Person 实体,我们可能想要确保这个 person 的 spouse 可被快速地取出:

Hibernate ORM 5.4.0 的第一个候选版本已发布。

更新内容

改进 EntityGraph

JPA 的 EntityGraph 功能定义和使用起来很麻烦。Hibernate ORM 5.4 增加了2个新功能,可帮助您更轻松地使用 EntityGraphs。请注意,所有这些改进都被视为孵化阶段。

EntityGraph 的解析功能

第一个功能是能够从 String 创建图形。例如,给定一个 Person 实体,我们可能想要确保这个 person 的 spouse 可被快速地取出:

final EntityGraph eg = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse", entityManager );      
      final Person personAndSpouse = entityManager.find( Person.class, 1,          Collections.singletonMap( "javax.persistence.fetchgraph", eg );

此解析支持 EntityGraph 创建的所有功能,包括子图和子类图。有关深入讨论和示例,请参阅 文档

EntityGraph 的操作功能

This is mainly about combining graphs. E.g.

final EntityGraph eg1 = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse", entityManager );      final EntityGraph eg2 = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse(age, dob)", entityManager );      final EntityGraph combinedGraph = org.hibernate.graph.EntityGraphs.merge( entityManager, Person.class, eg1, eg2 )      
      final Person personAndSpouse = entityManager.find( Person.class, 1,          Collections.singletonMap( "javax.persistence.fetchgraph", combinedGraph );

This is a very trivial example meant just for illustration. It can actually be much more easily defined as:

final EntityGraph combinedGraph = org.hibernate.graph.EntityGraphs.parse( Person.class, "spouse( age, dob )", entityManager );      
      final Person personAndSpouse = entityManager.find( Person.class, 1,          Collections.singletonMap( "javax.persistence.fetchgraph", combinedGraph );

支持 JDK 11

5.4.0 支持开箱即用的 JDK 11,例如,不需要 5.3 中所需的 其他依赖项或环境变量。

Bug fixes 和其他小改进

此版本包含许多错误修正和小的改进。

点此查看完整的更改列表

获取 5.4.0.CR1

http://hibernate.org/orm/releases/5.4/#get-it


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Pro HTML5 and CSS3 Design Patterns

Pro HTML5 and CSS3 Design Patterns

Michael Bowers / Apress / 2011-11-15 / GBP 35.50

Pro HTML5 and CSS3 Design Patterns is a reference book and a cookbook on how to style web pages using CSS3 and HTML5. It contains 350 ready--to--use patterns (CSS3 and HTML5 code snippets) that you ca......一起来看看 《Pro HTML5 and CSS3 Design Patterns》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

html转js在线工具
html转js在线工具

html转js在线工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具