内容简介: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
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Ajax修炼之道
(美)哥特兰、高伯瑞斯、艾米亚 / 徐锋,胡冰 / 电子工业出版社 / 2006-4 / 29.8
Ajax将静态Web页面转变为充满交互的应用。现在您不需要牺牲Web应用程序部署的简单性,就可以将“胖”客户端应用程序部署到客户端。不过对于很多人业说,Ajax看起来很难。这就是我们撰写本书的原因。作为实践的指导,本书揭开了Ajax神秘的面纱,教您如何以简单的方式使用Ajax。本书内容覆盖了DHTML、Javascript和闻名已久的XmlHttp Request回调技术的基础知识。您将了解如何将......一起来看看 《Ajax修炼之道》 这本书的介绍吧!
HTML 编码/解码
HTML 编码/解码
XML 在线格式化
在线 XML 格式化压缩工具