• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Beans

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please tell me

1. What are Java Beans.
2. What is the difference between Java Beans and Enterprise Java Beans

Thanks
 
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JavaBeans are special kinds of Java classes that are written so as to conform to a particular specification (most often recognized by private instance variables with public "getXXX" and "setXXX" methods).

EJBs are special kinds of Java classes that function as reusable software components (also written to a specification) and are designed to run within a special environment (an EJB container).
 
Smita Chopra
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steve Morrow:
JavaBeans are special kinds of Java classes that are written so as to conform to a particular specification (most often recognized by private instance variables with public "getXXX" and "setXXX" methods).

EJBs are special kinds of Java classes that function as reusable software components (also written to a specification) and are designed to run within a special environment (an EJB container).



Thanks for replying.
I had read somewhere that Java Beans are reusable components and as you mentioned above EJBs are also reusable components. So is the only difference between the two is that EJBs run in EJB container while Java Beans do not?
 
Steve Morrow
Ranch Hand
Posts: 657
Spring VI Editor Clojure
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

So is the only difference between the two is that EJBs run in EJB container while Java Beans do not?

There's a little more to it than that...

Here are a some articles that may help you with the distinction.

http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts.html
http://java.sun.com/docs/books/tutorial/javabeans/

http://www.javaworld.com/channel_content/jw-ejbs-index.shtml
http://www.javaworld.com/channel_content/jw-javabeans-index.shtml

http://www.javaranch.com/newsletter/July2003/TouringTheCommonsPart1.html
 
Ranch Hand
Posts: 1704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Smita Chopra:


Thanks for replying.
I had read somewhere that Java Beans are reusable components and as you mentioned above EJBs are also reusable components. So is the only difference between the two is that EJBs run in EJB container while Java Beans do not?



Yes Java Beans are reusable components and EJBs are distributed components. There is no link between Java Beans and EJBs.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi smita,
java beans are nothing but just general java classes with fields and corresponding getters and setters methods in them.
for e.g. int age;//if this is the instance variable
void setAge(int age){
this.age=age;
}//this is the setter that sets the age
int getAge(){
return this.age;
}//this is the getter

to use it simply create an object and then use them to set and get the age..


where as enterprise java beans are simply a different story. ejb are java components preferably known as business objects. they are deployed using an application server such as jboss, weblogic, etc... they have nothing to do with java beans. they have call back methods and so on... i think u have to do a bit of more researching for ejb....

cheers


Ansuman
 
reply
    Bookmark Topic Watch Topic
  • New Topic