Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros & Cons: Hibernate vs. EJB 3

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.

like image 594
Zack Marrapese Avatar asked Mar 16 '10 17:03

Zack Marrapese


People also ask

What do pros mean?

noun, plural pros. a proponent of an issue; a person who upholds the affirmative in a debate. an argument, consideration, vote, etc., for something.

What do pros and cons mean?

phrase. The pros and cons of something are its advantages and disadvantages, which you consider carefully so that you can make a sensible decision. Motherhood has both its pros and cons.

Are pros positive or negative?

When weighing options, we use “pros” to describe positives while using cons to describe negatives. The idiom “pro and con” compares the advantages and disadvantages of something with the intention to aid in the decision-making process.

Who invented pros?

In 1985, PROS was founded by Mariette and Ron Woestemeyer. After helping pioneer revenue management in the airline industry, PROS expanded into price management and pricing optimization.


1 Answers

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.

like image 170
Ken Liu Avatar answered Sep 29 '22 13:09

Ken Liu