Pros and Cons: Hibernate vs. EJB 3

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

I found this article, but actually it did not concern my question. If I don’t have any attachment to any technology, what would make me choose one by one? Or are there situations where I would like to use both?

Thanks Zack

edit: in response to comments: I know little about EJB3. I'm just trying to find out if this is something that would be viable for my company. If EJB3 is not compatible with Hibernate, please explain why.

+7
java orm hibernate jpa
source share
1 answer

JPA provides a subset of the Hibernate functions, but EJB3 provides other services that Hibernate does not address (e.g. web services, EJB, timer service)

JPA offers the following advantages over Hibernate:

  • Standardized API
  • Provider Independence (can switch between Hibernate, TopLink, OpenEJB, etc.)

Hibernate offers the following benefits:

  • Widely used
  • De facto standard
  • Direct support from Spring, Grails, etc.
  • Perhaps the best tools support
  • Additional Features Except JPA

What you can do is write an application in EJB using JPA, and then use Hibernate functions when necessary. Or just use simple Hibernate to save if you don't need standardization and vendor locking. Actually, you are unlikely to switch between Hibernate and another provider, but this will happen.

+9
source share

All Articles