内容简介: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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Spark SQL内核剖析
朱锋、张韶全、黄明 / 电子工业出版社 / 2018-8 / 69.00元
Spark SQL 是 Spark 技术体系中较有影响力的应用(Killer application),也是 SQL-on-Hadoop 解决方案 中举足轻重的产品。《Spark SQL内核剖析》由 11 章构成,从源码层面深入介绍 Spark SQL 内部实现机制,以及在实际业务场 景中的开发实践,其中包括 SQL 编译实现、逻辑计划的生成与优化、物理计划的生成与优化、Aggregation 算......一起来看看 《Spark SQL内核剖析》 这本书的介绍吧!