*
The moose likes EJB and other Java EE Technologies and the fly likes What Is The Difference Between JavaBeans and EJB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "What Is The Difference Between JavaBeans and EJB?" Watch "What Is The Difference Between JavaBeans and EJB?" New topic
Author

What Is The Difference Between JavaBeans and EJB?

Robert Higgins
Greenhorn

Joined: Feb 17, 2004
Posts: 1
I am new to EJB, and have started a research project on the technology. I am looking for the differences between JavaBeans and EJB.
I have been told that one of the main differences is that EJB is distributed, while JavaBeans is not. Although, this person admits he does not know much about EJB.
Any help appreciated
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi,
JavaBeans are completely different from Enterprise JavaBeans (EJB).
JavaBeans are Java classes that have get/set methods defined.
They are reusable Java components with properties,events,and methods that can be easily grouped together to create Java applications.
JavaBeans are much smaller than EJB.
Use JavaBeans to assemble larger components or to build entire applications.JavaBeans,however,are development components and are not deployable components .
User does not deploy a JavaBean;rather,JavaBeans help you construct larger
software that is deployable.And because they cannot be deployed,JavaBeans do
not need to live in a runtime environment.Since JavaBeans are just Java classes,they do not need an application server to instantiate them,to destroy them,and to provide other services to them.The application itself is made up of JavaBeans.
Enterprise JavaBeans (EJB)is a server-side component architecture that simplifies the process of building enterpriseclass distributed component applications in Java.
By using EJB,you can write scalable,reliable,and secure applications without writing your own complex distributed component framework.
EJB is about rapid application development for the server side;
Construct server-side components in Java by leveraging a prewritten distributed infrastructure provided by the industry.
EJB is designed to support application portability and reusability across any vendor �s enterprise middleware services.
EJB is a vast topic. Too lengthy to describe here.
Appreciate if u go to java.sun.com to study the same and download pdf files such as mastering EJB by ED Roman or his books or refer to the specs pdf files.
Rgds,
Seetesh
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Please correct me. EJB and JavaBeans are any Java classes. There are no any specific requiremnts though. Now differences:
- JavaBeans can require BeanInfo class
- EJB require home interfaces
- JavaBeans live in bean container and calls are local
- EJB live in EJB container and calls can be as local as remote
- JavaBeans have simple life cycle
- EJB can have more complex


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi D Rog,
Cld u ellaborate on the life cycle of Java Bean?
Rgds,
Seetesh
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Originally posted by Robert Higgins:
I am new to EJB, and have started a research project on the technology. I am looking for the differences between JavaBeans and EJB.
I have been told that one of the main differences is that EJB is distributed, while JavaBeans is not. Although, this person admits he does not know much about EJB.
Any help appreciated

JavaBeans are reusable components with certain naming conventions.
They are used for clientside GUI development and have their own specification mentioned at Sun's site.
In Web applications, plain java classes are used along with JSP/Servlet applications. They are also called JavaBeans as they also have similar naming conventions, can be used to capture form-submitted data and also represent the model/database layer.
Enterprise Java Beans are also resuable components that contain business logic and run in a special environment called the EJB Container, (a part of the Web Application Server). They offer special services like Persistence, transaction management, object distribution, security, messaging, location transparency etc...
For example: In an MVC architecture based web application, EJBs can be used to represent the model layer, JSPs could represent views and Servlet, the controller.
Yes, EJBs support distributed transactions also. It is possible for a J2EE client like JSP/Servlet to call an EJB running in the same machine or a different machine. One EJB can also call another EJB running on a different machine or a different application server.
[ February 19, 2004: Message edited by: Vish Kumar ]
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
just to be on fun side...
There is this whole "enterprise size" difference b/w JB and EJB
Regards
Maulin
Balaji Thirnrayan
Greenhorn

Joined: Nov 13, 2003
Posts: 8
AGUMENT THIS
JAVA BEAN is devolepment component, Meaning using a JAVA BEAN you can develop a bigger software componnent.
EJB is deployable component which runs on an J2EE Application Server.
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi Balaji,
"JAVA BEAN is devolepment component, Meaning using a JAVA BEAN you can develop a bigger software componnent"
Does this mean that EJB cant develop a similar component?
Seetesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What Is The Difference Between JavaBeans and EJB?
 
Similar Threads
Enterprise JavaBeans 3.0 or 3.1
javabean and EJB
Java beans - activeX bridge question
Java beans - activeX bridge question
Is JavaBean for GUI?