Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EJB vs Hibernate

Tags:

java

hibernate

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

like image 603
feiroox Avatar asked Dec 30 '22 03:12

feiroox


1 Answers

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.

like image 57
Gareth Davis Avatar answered Jan 01 '23 15:01

Gareth Davis