permaculture playing cards*
The moose likes EJB and other Java EE Technologies and the fly likes difference between EJB and Java bean ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "difference between EJB and Java bean ?" Watch "difference between EJB and Java bean ?" New topic
Author

difference between EJB and Java bean ?

siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59
As far as i know java bean has private member variable, getters and setter methods used to map the input parameters with the fields in the database and EJB is a server side component has some business service methods and these methods called from the client side. Correct me if i am wrong and please tell me the exact difference.
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Hi siva, yes what you have written is correct. Beans are standard pojos in java while ejb is a business component which has server level support for functions like security, session management and transaction. In fact nothing is common.
siva chaitanya
Ranch Hand

Joined: Jul 05, 2011
Posts: 59
Hi harshvardhan thank you for your reply can you please give me some real time example of EJB and what is the use of exposing the business methods through EJB
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Hi siva, while writing any business logic, you need to have a controlled environment, and you need to manage a lot of things. So here you have ejb compliant servers.
So you don't need to manage all the system level services, which are already being managed by application servers like transactions,security,life cycle ,threading,persistence etc.

No one framework or component can resolve all business problem, so once you will learn EJB you will understand when to choose it and also you are going to appreciate the way it works.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

EJBs are magic things. With simple @Stateless annotation you have a managed, transactional component that is monitored by application server. JavaBeans and EnterpriseJavaBeans have rather little in common.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
 
jQuery in Action, 2nd edition
 
subject: difference between EJB and Java bean ?
 
Similar Threads
How to understand Passed by Reference or Copy of Value for Local or Remote Interface?
use EJB in <html:form>
Database synchronization with Entity Bean
Difference b/w Simple Java Bean and Enterprise Java Bean(EJB)
EJB and JavaBeans