优点&缺点:Hibernate与EJB 3 [英] Pros & Cons: Hibernate vs. EJB 3

查看:94
本文介绍了优点&缺点:Hibernate与EJB 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hibernate& H的优缺点是什么? EJB3相对于彼此吗?



我发现这个

一个>后,但它并没有真正解决我的问题。如果我对这两种技术没有特别的联系,那么我会选择哪一种呢?或者是否有我想同时使用的情况?



谢谢,
Zack



编辑:回复评论:我对EJB3不太了解。我只是想知道这对我的公司是否可行。如果EJB3与Hibernate没有可比性,请解释原因。JPA提供了Hibernate功能的一个子集,但EJB3提供了Hibernate无法解决的其他服务(例如Web服务,EJB,定时服务)。
$ b

与Hibernate相比,JPA提供了以下优势:




  • 标准化API
  • 供应商独立性(可以在Hibernate,TopLink,OpenEJB等之间切换)


Hibernate提供以下好处:


  • 广泛使用

  • 实际标准

  • 直接支持Spring,Grails等。

  • 可能更好的工具支持

  • JPA的更多特性



您可以使用JPA在EJB中编写应用程序,使用Hibernate特有的功能。或者,如果您不关心标准化和供应商锁定,只需使用普通的Hibernate进行持久化即可。实际上,你不太可能在Hibernate和其他提供商之间切换,但确实发生了。


What are the advantages and disadvantages of Hibernate & EJB3 relative to each other?

I found this post, but it didn't really address my question. If I don't have any particular tie to either technology, what would cause me to pick one over the other? Or are there situations where I would want to use both?

Thanks, Zack

edit: in response to comments: I don't know much about EJB3. I'm just trying to learn if it's something that would be viable for my company. If EJB3 isn't comparable to Hibernate, please explain why.

解决方案

JPA provides a subset of Hibernate functionality, but EJB3 provides other services that Hibernate does not address (e.g. Web services, EJBs, Timer service)

JPA offers the following benefits compared to Hibernate:

  • Standardized API
  • Vendor independence (can switch between Hibernate, TopLink, OpenEJB, etc.)

Hibernate offers the following benefits:

  • Widely used
  • De facto standard
  • Direct support from Spring, Grails, etc.
  • Possibly better tools support
  • More features than JPA

What you can do is write your application in EJB using JPA and then when necessary use Hibernate-specific features. Or just use plain Hibernate for persistence if you don't care about standardization and vendor lock-in. Realistically, it's unlikely you will switch between Hibernate and another provider, but it does happen.

这篇关于优点&缺点:Hibernate与EJB 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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