Thursday, September 8, 2011

Enterprise Java Beans - A Broad Overview

What are Enterprise Java Beans: Enterprise java beans are Java EE server side business layer components. They can be used to develop highly available distributed transactional systems. Like servlets and JSPs are used to develop view components in java EE, EJBs are used to develop business logic. Today, I am not going to discuss how an EJB can be deployed on the server. There are just too many tutorials available on the internet. I will discuss the need to use EJB, where it fits and what it gives. In the recent times, people have preferred Spring framework instead of EJB, the advantage of what is being lightweight. It however needs to be discussed that being lightweight is not the only qualities a business framework needs to have. There is a limit to how much spring can scale. There are also somethings spring simply cannot handle, not at least without external component injected through its AOP framework. Enterprise Java Beans are complex and heavier weight, because they attempt to provide solution to much more complex regime of problems. Also note that, unlike spring, EJB is not a product, its a specification. Which means you would have a choice among many implementations, both proprietary and open source, of EJB; where as there is only one spring.

However, after EJB 3.x, deploying and programming EJBs are easier than doing so with spring... believe me.