File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes diffrence between javabeans and ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "diffrence between javabeans and ejb" Watch "diffrence between javabeans and ejb" New topic

diffrence between javabeans and ejb

Dharmender Singh

Joined: Jun 14, 2007
Posts: 16
can anybdy tell me that what is the diffrence between javabeans and ejb and can we run the javabeans in ejb container

thanks in advance,
dharmender singh
Pavel Kubal
Ranch Hand

Joined: Mar 13, 2004
Posts: 360
Java Beans are basically data containers. Simple class with private or protected member variables and getters and setters for each of them. Usually a no-arg constructor is required as well. These components are used to transfer data from one component to another.

While Enterprise Java Beans are distributed server-side components, which must be run in an EJB container. This is one difference - JB can be run anywhere, but EJB only in the server JVM. Whatsmore, EJB come in three flavours - Session for performing business logic, Entity for persistence (nowadays it's called JPA) and Message driven for messaging.

This should be enough for knowing the difference, if you'd like any specific details, don't hesitate to ask.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
More discussion on this subject can be found at JavaBeansAndEnterpriseJavaBeans.
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Best advice I can give you this: Just because their names are similar, don't assume they are in anyway related.

Its like someone saying that Javascript is the same as Java. Bad use of naming. EJBs are heavy-weight modules that require specialized J2EE servers whereas java beans can be made out of almost any class with very little overhead. Just ignore the overused naming and consider them distant relatives.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: diffrence between javabeans and ejb
It's not a secret anymore!