| Author |
Java Bean vs EJB
|
Aaron Roberts
Ranch Hand
Joined: Sep 10, 2002
Posts: 174
|
|
IIRC an EJB is an Enhanced Java Bean? In a nutshell, how does an EJB differ from a Java Bean? A bean is pretty much just the getters and setters for fields off of an html form correct? Does an EJB contain more program logic? Regards, Aaron R>
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Strictly a JavaBean is a component designed for GUI programming. The term predates J2EE and specifies a self-contained software component, i.e. it will contain both properties and methods to publish changes in those properties (typically event driven and using introspection). The term has been co-opted in the J2EE world to basically mean a class which represents some data - it has accessor and mutator methods which would be used by (for example) JSP to disply the data in a web application. So you are right, it is pretty much "the getters and setters for fields off of an html form" An Enterprise Java Bean is a completely different type of component. The key difference with any other Java class is it they are designed to work in a distributed, multi-user environment. EJBs can only exist within an EJB container (Weblogic, Websphere, JBoss etc.), and they provide certain behaviour that is usually required for this type of software component: transaction management, (implicit) thread management, declaritive security, clustering etc. Have a look at the J2EE tutorial on Sun's site for an introduction.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Aaron Roberts
Ranch Hand
Joined: Sep 10, 2002
Posts: 174
|
|
Thanks for the info! That was exactly what I needed to know. Know I don't have to worry that my beans are the wrong type of bean just because I didn't understand the terminology. Regards, Aaron R>
|
 |
 |
|
|
subject: Java Bean vs EJB
|
|
|