feiroox
feiroox

Reputation: 3199

EJB vs Hibernate

When is better to use Hibernate and when EJB 3? Aren't there any impediments with either Hibernate or EJB 3?

Upvotes: 4

Views: 2417

Answers (2)

Chris Johnston
Chris Johnston

Reputation: 1919

Since Hibernate can be used as an implementation for JPA, you can use it and still be using EJB3. As such, I agree with gid and suggest that you use the JPA stuff in Hibernate until you can't and only then move to Hibernate specific bits.

Upvotes: 2

Gareth Davis
Gareth Davis

Reputation: 28069

I'm in the direct hibernate camp here.

Just think how likely it is that your going to what to change your database say from DB2 to oracle, well that is about as likely as changing from Hibernate to Toplink or eclipse it just isn't going happen that often. It's the same old thing that programmers just love to do and that is abstract any stuff so that they can in at some unforeseen point 10 years from now choose to use a different logging tool kit or what not.

There are I'm sure people out there that really want the vendor independence of JPA but I'm not one of them. That's not to say that Toplink or eclipse aren't any good, I just don't think you can use a product that complex and not be tied (even unintentionally) to it in some way.

Having said that I still follow the hibernate documentation advice and use the JPA annotations and only resort to the hibernate specific ones when I need to, not quite sure if there is a technical reason for this, but it doesn't hurt.

Upvotes: 8

Related Questions