Monday, June 24, 2013

Hibernate Vs Spring

Hi,
Either your are a professional or a novice I am sure you have already been stroke the first time by these terms Hibernate, Spring and then ask yourself what is even the difference between them.
  • Hibernate = a persistance framework.
  • Spring = a web application framework 
In simple language , Hibernate a is just an ORM a tool that provides some easiness to deal with database or to abstract it.
Spring can be compared with  JSF or STRUTS.
Spring is an enterprise web application framework that make use of hibernate to persist data.
Spring itself does not have persistence features it borrows them from hibernate.
Spring allows programmer to follow MVC architecture.

   I hope you have certainly got the idea.

Friday, June 21, 2013

EJB vs JPA vs Hibernate : Part 1

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.

  1. EJB: it a large set of specifications (security, transactions, persistence management, Timer services , administrations)
  2. JPA:  it a part of EJB specification that refers to persistence. (i.e: some empty crud methods)
  3. Hibernate: it an implementation of JPA specification. (i.e: implemented crud methods) 
  Notes:
  •   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.
I am not an expert but I have tried through this short post to share my understanding of these terms.

Part 2 coming soon.