difference between javabeans and ejb

Upload: priyadharshini-vaithianathan

Post on 07-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Difference Between JavaBeans and EJB

    1/3

    Difference between JavaBeans and EJB:

    Oi, Check and select the required points alone, some may berepetition of the same idea,

    1.

    JavaBeans:------------------Basically used to CUSTOMIZE EXISTING OBJECTS. I.e. you cancreate USER OBJECTS, which are based on existing objects.For Example: A default button operates as a Single-State Switch. I.e. when youpress a button on a web page, it doesn't remain pressed. In fact, it immediatelybounces back to its OFF state like a Door-Bell.

    Now, let's say, you need a button, which should have 2 stable states, like thetypical Electrical Light Switch. So, in this case, what you can do is, take anexisting button (having 1 stable state) and CUSTOMIZE it so that it has 2 stablestates.This is possible using JavaBeans.

    Enterprise Java Beans (EJB):------------------------------------------EJB is a completely different concept than the one mentionedabove. It is NOT used to customize existing objects. Insteadthey are basically used to STANDARDIZE the way, in whichbusiness logic is written.

    For Example: We can write our business logic as well as the GUI logic, insideServlets/Applets/ Standalone applications itself. But this way, there will be noclear distinction between the Code that is responsible for the GUI and the actualBusiness logic code, because everything is written inside the same class file.

    So, to COMPONENTIZE we write business logic in separate class files than theGUI logic, thereby making a clear distinction between the responsibilities

    2.

    Java Beans and EJBs are used for different purposes altogether though both

    specifications are provided by Sun micro Systems. Java Beans are mainly meantfor building extendable components and typically contain getters and setters forall its data members along with other required functionality. EJBs are server sideprograms that typically implement middle layer business functionality providing3 - layer architecture for applications. EJBs can be Entity Session or Messagedepending on the required functionality. Most of the critical services are providedby EJB containers and thus allowing the programmmer to concentrate on thebusiness logic on hand.

  • 8/6/2019 Difference Between JavaBeans and EJB

    2/3

    3.

    A Java Bean is a software component written in theJava programming language that conforms to the

    JavaBeans component specification.

    The JavaBeans APIs became part of the "core" Java APIs

    as of the 1.1 release of the JDK. The JavaBeansspecification defines a Java-based software component

    model that adds a number of features to the

    Java programming language. Some of these featuresinclude:

    introspectioncustomization

    events

    properties

    persistence

    Enterprise JavaBeans (EJBs) are Java-based software componentsthat are built to comply with Java's EJB specification

    and run inside of an EJB container supplied by

    a J2EE provider. An EJB container provides distributedapplication functionality such as transaction

    support, persistence and lifecycle management for the EJBs

    4.

    JB

    JavaBeans takes a low-level approach to developing reusable softwarecomponents that can be used for building different types of Java applications(applets, stand-alone apps, etc.) in any area.

    EJB

    Enterprise JavaBeans takes a high-level approach to building distributedsystems. It frees the application developer to concentrate on programming onlythe business logic while removing the need to write all the "plumbing" code that'srequired in any enterprise application.

    5.

    1. JavaBeans may be visible or invisible at runtime. For

  • 8/6/2019 Difference Between JavaBeans and EJB

    3/3

    example, the visual GUI component may be a button, listbox, graphic or a chart.

    An EJB is a non visual, remote object.2. JavaBeans are intended to be local to a single processand are primarily intended to run on the client side. Although

    one can develop server-side Java Beans, it is far easier todevelop them using the EJB specification instead.EJB's are remotely executable components or business

    objects that can be deployed only on the server.3. JavaBeans is a component technology to create genericJava components that can be composed together into appletsand applications.

    Even though EJB is a component technology, it neitherbuilds upon nor extends the original Java Bean specification.4. Java Beans have an external interface called the propertiesInterface, which allows a builder tool to interpret thefunctionality of the bean.

    EJBs have a deployment descriptor that describes itsfunctionality to an external builder tool or IDE5. Java Beans may have Bean Info classes, property editors orcustomizers

    EJB's have no concept of BeanInfo classes, propertyeditors or customizes and provide no additional informationother than that described in the deployment descriptor.

    6. JavaBeans are not typed.EJBs are of two types - session beans and entity beans.

    7. No explicit support exists for transactions in java Beans.

    EJB's may be transactional and the EJB servers providetransactional support.

    8. Component bridges are available for JavaBeans. For ex: ajavabean can also be deployed as an ActiveX control.

    An EJB cannot be deployed as an ActiveX control becauseActiveX controls are intended to run at the desktop andEJB's are server side components. However CORBA-IIOPcompatibility via the EJB-to-CORBA mapping is defined by theOMG.