Pros & Cons: Hibernate vs. EJB 3

前端 未结 1 1381
庸人自扰
庸人自扰 2021-02-09 08:09

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

相关标签:
1条回答
  • 2021-02-09 08:39

    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.

    0 讨论(0)
提交回复
热议问题