Monday, July 25, 2005

Struts, Spring & Hibernate

Some of my friends were trying to compare Struts, Spring and Hibernate. These were the points which struck me when I thought about these:

Struts:
It is merely just an implementation of MVC pattern. You can develop a web application with it.

Spring:
This framework has a whole lot of implementations apart from MVC. It enables applications to be developed with simple POJOs. Declarative transaction, data access framework, dependency injection - all for POJOs. No plumbing code, properties, or lot of XMLs, all these are taken care by dependency injection and inversion control.

The main selling point here is that one do not need to write EJB now in order to achieve the declarative transaction and security. POJO + Spring will be able to deliver that.

So, this framework is not only for the web application but can be considered for the wide range of J2EE applications when compared with Struts.

Hibernate:
Spring doesnt have any Object relational mapping implementation, rather allows a generic data access mechanism, wherein JDBC or Hibernate can be used. Normally Hibernate is the option for the developers who use Spring, that is the reason why Hibernate comes into the picture when they talk about Spring. Apart from that, there is one major relation between Spring and Hibernate is that both are POJO based. That is, Hibernate enables us to write a POJO and map it with a datastore, rather than developing an entity bean and end up writing lot of plumbing code.

Sounds, Spring + Hibernate is very easy to develop, deploy and test POJO based components, which can be transactional, secure, mapped to a datastore. So, would it take over EJB in future? May be EJB 3.0 is the answer for this!

No comments: