JPA或Hibernate for Java持久性? [英] JPA or Hibernate for Java Persistence?

查看:142
本文介绍了JPA或Hibernate for Java持久性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Java,.NET和Groovy中企业应用程序的开发。对于每个平台,我们将尝试实现一个简单的SOAP Web服务是多么困难。我们将使用最常用的工具和库,以尽可能准确地研究现实世界。



在这方面,当使用Hibernate进行持久化时,会它更好地反映了真实世界中使用新的JPA(Java持久性API),还是在JPA出现之前存在的Hibernate自定义API?

>

正如你可能已经知道的那样,从3.2开始,Hibernate已经通过了JPA认证。您可以轻松使用Hibernate作为您的JPA提供程序,而不必使用任何Hibernate的自定义API。



我建议直接使用JPA和Hibernate作为提供程序。并使用注释而不是XML(更好)。

然后,当你需要额外的东西时,你总能得到Hibernate Session。例如,我经常发现我需要这样做,以便将集合作为参数传递给查询(setParameterList)。


I'm researching the development of Enterprise Applications in Java, .NET and Groovy. For each platform, we're going to try how hard it is to realize a simple SOAP web service. We'll use the tools and libraries that are most commonly used, to research the real world as accurately as possible.

In this regard, when using Hibernate for persistence, would it better reflect the real world to use the new JPA (Java Persistence API), or the Hibernate custom API that existed before JPA came around?

解决方案

As you're probably already aware, as of 3.2 Hibernate is JPA certified. You can easily use Hibernate as your JPA provider without having to use any of Hibernate's "custom" APIs.

I'd recommend using straight JPA with Hibernate as the provider. And use annotations rather than XML (much nicer).

Then when you need a little something extra you can always get the Hibernate Session. For example I often find I need to do this in order to pass a collection to a query as a parameter (setParameterList).

这篇关于JPA或Hibernate for Java持久性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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