<< Click here to Goto HomePage


Wednesday, July 22, 2009

Simple difference between Java Beans and Enterprise Java Beans(EJB)

JavaBean - A Java Bean is a software component written in the Java programming language that conforms to the JavaBeans component specification. It is an API for objects which expose their properties via standard naming convention (getXXX(), setXXX(), isXXX()). These properties can be determined at runtime via reflection and introspection. For true JavaBeans, they should be Serializable and have a default constructor. The orginal intent was to make them easy for tooling (tools could discover their properties, expose them to configuration, etc.).

The JavaBeans APIs became part of the "core" Java APIs as of the 1.1 release of the JDK.

EJB - Enterprise JavaBeans (EJBs) are Java-based software components that are built to comply with Java's EJB specification and run inside of an EJB container supplied by a J2EE provider. It is an "enterprise" api for distributed objects. Provides a standard approach to building such objects and allowing an EJB container (EJB application server) to manage the lifecycle of the beans. EJB's provide persistance, scalability, and distributed transaction support (via the container).

An EJB or an enterprise java container provides distributed application functionality such as transaction support, persistence and lifecycle management for the EJBs. Further Details about apache tomcat or simply tomcat server and JavaBeans can be found at Sun Java Tutorial.