内容简介:Hibernate ORM 5.4.0 的第一个候选版本已发布。 更新内容 改进 EntityGraph JPA 的 EntityGraph 功能定义和使用起来很麻烦。Hibernate ORM 5.4 增加了2个新功能,可帮助您更轻松地使用 EntityGraphs。请注意,所有...
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
What's next?
将在未来几周内发布 5.4.0.Final,并在此后发布定期维护版本。
详情 http://in.relation.to/2018/11/15/hibernate-orm-540-cr1-out/
【声明】文章转载自:开源中国社区 [http://www.oschina.net]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
JAVA核心技术(卷1)
Cay S. Horstmann、Gary Cornell / 杜永萍、邝劲筠、叶乃文 / 机械工业出版社 / 2008-6 / 98.00元
《JAVA核心技术(卷1):基础知识(原书第8版)》是《Java核心技术》的最新版,《Java核心技术》出版以来一直畅销不衰,深受读者青睐,每个新版本都尽可能快地跟上Java开发工具箱发展的步伐,而且每一版都重新改写了的部分内容,以便适应Java的最新特性。本版也不例外,它反遇了Java SE6的新特性。全书共14章,包括Java基本的程序结构、对象与类、继承、接口与内部类、图形程序设计、事件处理......一起来看看 《JAVA核心技术(卷1)》 这本书的介绍吧!
MD5 加密
MD5 加密工具
HSV CMYK 转换工具
HSV CMYK互换工具