Hi,
Today I am going to address one of the hot issues that I always try to grab.
Like many newbies making their first step with the persistence, sometimes they are confused with these terminologies: ejb, jpa, hibernate and so on.
The persistency technology has become unavoidable giving the advantages that it provides over JDBC: speed, flexibility , security at the price of a higher learning curve.
This is going to be a continuous debate and I will go straight to the point.
In short how can we differentiate between EJB, JPA and Hibernate.
Part 2 coming soon.
Today I am going to address one of the hot issues that I always try to grab.
Like many newbies making their first step with the persistence, sometimes they are confused with these terminologies: ejb, jpa, hibernate and so on.
The persistency technology has become unavoidable giving the advantages that it provides over JDBC: speed, flexibility , security at the price of a higher learning curve.
This is going to be a continuous debate and I will go straight to the point.
In short how can we differentiate between EJB, JPA and Hibernate.
- EJB: it a large set of specifications (security, transactions, persistence management, Timer services , administrations)
- JPA: it a part of EJB specification that refers to persistence. (i.e: some empty crud methods)
- Hibernate: it an implementation of JPA specification. (i.e: implemented crud methods)
- Hibernate is just an ORM tool.
- Hibernate and EJB ( or EJB 3) are completely different concepts and cannot be compared. EJB 3.0 is a specification of architecture for developing and deploying server side managed components (beans). The architecture manages the lifecycle of beans and also provides services like security, transactions, persistence management, Timer services , administration etc.
- Using JPA in combination with EJB 3 is the easiest solution. Using JPA or Hibernate standalone requires much more verbose code and you manually have to manage transactions, which can be a pain.
- JPA vs Hibernate is another debate. JPA has the benefit of having the standardized interfaces, so more developers will likely be familiar with it. On the other hand, the native Hibernate APIs are always a super set of those of JPA and thus offer more power.
- JPA is a set of methods without implementation. This set provides everything you need to organize the mapping of objects to database tables, CRUD operations, managing transactions. Meanwhile, Hibernate is one of the implementations of JPA. It contains all the method’s realizations and even extends the set of methods with its own.
Part 2 coming soon.
thanks for this. nice article!
ReplyDeleteThanks..! Good Post..:)
ReplyDelete