Java JPA 和 JPA2 之间的差异

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1341665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 08:26:13  来源:igfitidea点击:

Differences between JPA and JPA2

javajpajakarta-eejpa-2.0

提问by Guillermo Vasconcelos

Does anyone have a list of the changes between JPA 1 and JPA 2? I have read about the Criteria queries and other changes, but I would like a "what's new" kind of reference. Thanks

有没有人有 JPA 1 和 JPA 2 之间变化的列表?我已阅读有关标准查询和其他更改的信息,但我想要“新功能”类型的参考。谢谢

回答by ChssPly76

Googlereturns many results, including thisand thisblog posts. The summary (copied from the former) is:

谷歌返回许多结果,包括这篇这篇博文。摘要(从前者复制而来)是:

  • Added support for persistently ordered lists using OrderColumn and provider-managed ordering column
  • Defined support for foreign key mapping strategy for unidirectional one-to-many relationships
  • Added clear method to EntityManager interface to allow entities to be evicted from the persistence context; added CLEAR cascade option.
  • Added Cache interface.
  • Added support for pessimistic locking and new lock mode types.
  • Added overloaded find and refresh methods added to support locking with standardized and vendor-specific properties and hints.
  • Added standardized hint javax.persistence.lock.timeout for use in locking configuration.
  • Added the standardized properties javax.persistence.jdbc.driver, javax.persistence.jdbc.url, javax.persistence.jdbc.user, javax.persistence.jdbc.password for use in persistence unit and entity manager factory configuration.
  • Added Query getNamedParameters and getPositionalParameters methods.
  • 添加了对使用 OrderColumn 和提供者管理的排序列的持久排序列表的支持
  • 定义了对单向一对多关系的外键映射策略的支持
  • 为 EntityManager 接口添加了 clear 方法,以允许从持久化上下文中驱逐实体;添加了 CLEAR 级联选项。
  • 添加缓存接口。
  • 添加了对悲观锁定和新锁定模式类型的支持。
  • 添加了重载查找和刷新方法,以支持使用标准化和特定于供应商的属性和提示进行锁定。
  • 添加了用于锁定配置的标准化提示 javax.persistence.lock.timeout。
  • 添加了标准化属性 javax.persistence.jdbc.driver、javax.persistence.jdbc.url、javax.persistence.jdbc.user、javax.persistence.jdbc.password 以用于持久性单元和实体管理器工厂配置。
  • 添加了查询 getNamedParameters 和 getPositionalParameters 方法。

回答by Miguel Ping

JPA2 also adds typesafe query api. see http://www.ibm.com/developerworks/java/library/j-typesafejpa/

JPA2 还添加了类型安全查询 api。请参阅http://www.ibm.com/developerworks/java/library/j-typesafejpa/

回答by Hardy

There is also a pdf version of Mike Keith's presentation "What's New and Exciting in JPA 2.0" from Jazoon 2009.

还有一个 pdf 版本的 Mike Keith 的演讲“ JPA 2.0 中的新功能和令人兴奋的内容”来自 Jazoon 2009。

回答by Leon

There is a new interface javax.persistence.TypedQueryadded to control the execution of typed queries.

javax.persistence.TypedQuery添加了一个新界面来控制类型查询的执行。