What is the difference between EJB and Java beans?

What is the difference between EJB and Java beans?

Java Beans :

- Java beans are reusable components that can be used for customized user objects.

- Java beans adhere to two methods known as setter and getter methods and one public constructor.

- For example: an employee object can be used to set (setter method) and get (getter method) employee details which are a customized object.

- AWT and Swing components are based on java beans.

Enterprise Java Beans (EJB) :

- EJB are reusable components that are developed to comply with enterprise specification adhering to setter and getter methods and one public constructor.

- These beans are running in an EJB container of J2EE architecture.

What is the difference between EJB and Java beans?

JavaBeans :

- JavaBeans may be visible or nonvisible at runtime.

- JavaBeans are intended to be local to a single process and are primarily intended to run on the client side.

- Although one can develop server-side JavaBeans, it is far easier to develop them using the EJB specification instead.

- JavaBean is a component technology to create generic java components that can be composed together into applets and applications.

- JavaBeans have an external interface called the properties interface, which allows a builder tool to interpret the functionality of the bean.

- JavaBeans may have BeanInfo classes,property editors or Customizers.

- JavaBeans have no types.

- No explicit support exists for transactions in JavaBeans.

- Component bridges are available for JavaBeans.


- An EJB is a nonvisual, remote object.

- EJB's are remotely executable components or business objects that can be deployed only on the server.

- Even though EJB is a component technology, it neither builds upon nor extends the original JavaBean specification.

- EJBs have a deployment descriptor that describes its functionality to an external builder tool or IDE.

- EJB's have no concept of BeanInfo classes, property editors or customizers and provide no additional information other than that described in the deployment descriptor.

- EJBs are of two types - session beans and entity beans.

- EJB's may be transactional and the EJB servers provide the transactional support.

- An EJB cannot be deployed as an ActiveX control because ActiveX controls are intended to run at the desktop and EJB's are server side components. However CORBA-IIOP compatibility via the EJB-to-CORBA mapping is defined by the OMG.
What’s new in the EJB 2.0 specification?
New in the EJB 2.0 specification - The following are the differences specified by Sun in EJB 2.0 Local interfaces, which improve the efficiency of intra-container entity relationships..
What is the difference between EAR, JAR and WAR file?
Difference between EAR, JAR and WAR file - .jar files: These files have .jar extension. A .jar file contains .class files, resources like .java and property files...
What is EJB client JAR file?
What is EJB client JAR file? - EJB client JAR file: This file is used for client projects. This file includes the .class files of the client.....
Post your comment