Java Persistence API(JPA)实现应使用哪个提供程序 [英] Which provider should be used for the Java Persistence API (JPA) implemenation

查看:128
本文介绍了Java Persistence API(JPA)实现应使用哪个提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Java Persistence API(JPA)用于我的Web应用程序.

I want to use the Java Persistence API (JPA) for my web application.

有流行的JPA实现,例如 Hibernate Toplink EclipseLink . 哪种实现是一个很好的选择,为什么?

There are popular JPA implementations like Hibernate, Toplink and EclipseLink. What implementation is a good choise and why?

推荐答案

开发 Java持久性API(API)时,它很快流行起来. JPA描述了使用Java的应用程序中关系数据的管理.

When the Java Persistence API (API) was developed, it became popular very fast. JPA describes the management of relational data in applications using Java.

JPA(Java持久性API)是持久性提供程序要实现的接口.

休眠是JPA的一种实现.当将Hibernate与JPA结合使用时,实际上是在使用Hibernate JPA实现.

Hibernate is one such implementation of JPA. When you use Hibernate with JPA you are actually using the Hibernate JPA implementation.

JPA通常通过Java类中的注释定义元数据.也可以通过XML或两者结合使用. XML配置会覆盖注释.

JPA typically defines the metadata via annotations in the Java class. Alternatively via XML or a combination of both. A XML configuration overwrites the annotations.

JPA实现:

JPA implementations:

  • 休眠:最先进且使用最广泛的.注意 classpath,因为使用了很多库,尤其是在使用时 JBoss.支持JPA 2.1.
  • Toplink :仅支持基本的JPA规范. (这是甲骨文的免费软件 版本的JPA实现)
  • EclipseLink :基于TopLink,是预期的前进路径 为Oracle和TopLink提供持久性.支持JPA 2.1
  • Apache OpenJPA :最佳文档,但似乎有很多错误.开源的 JPA的实施.支持JPA 2.0
  • DataNucleus :有据可查的开放源代码(Apache 2许可证),也是JDO提供者.支持JPA 2.1
  • ObjectDB :有据可查
  • CMobileCom JPA :适用于Java和Android的轻量级JPA 2.1实现.
  • Hibernate: The most advanced and widely used. Pay attention for the classpath because a lot of libraries are used, especially when using JBoss. Supports JPA 2.1.
  • Toplink: Only supports the basic JPA specs. (This was oracle’s free version of the JPA implementation)
  • EclipseLink: Is based on TopLink, and is the intended path forward for persistence for Oracle and TopLink. Supports JPA 2.1
  • Apache OpenJPA: Best documentation but seems very buggy. Open source implementation for JPA. Supports JPA 2.0
  • DataNucleus: Well documented, open source (Apache 2 license), is also a JDO provider. Supports JPA 2.1
  • ObjectDB: well documented
  • CMobileCom JPA: light-weight JPA 2.1 implementation for both Java and Android.

其他方法是:

Other approaches are:

  • 普通JDBC
  • 与Hibernate一起进行ORM:Hibernate现在也非常支持JPA
  • iBatis:项目移至MyBatis(链接)
  • JDO
  • Plain JDBC
  • ORM with Hibernate: Hibernate is now also very supportive for JPA
  • iBatis: The project moved to MyBatis (link)
  • JDO

将Hibernate的动机作为我的JPA选择:

  • 成熟的项目:
    • 最先进的
    • 有据可查
    • Mature project:
      • Most advanced
      • Well documented
      • 休眠工具:自动生成代码和数据库生成
      • 休眠验证:bean规范功能.与JPA2集成
      • 休眠搜索:对域对象进行强大的全文搜索
      • 大发展社区
      • 广泛使用

      在最终规范发布之后,Hibernate很快成为JPA的开源实现.它具有丰富的功能集并可以快速生成新功能,因为开源开发过程往往比Java社区过程要快.

      Hibernate became an open source implementation of JPA very fast after the final specification was published. It has a rich feature set and generates new features fast, because an open-source development process tend to be faster then a Java community process.

      这篇关于Java Persistence API(JPA)实现应使用哪个提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆