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.
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.
posted 7 years ago
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
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.
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.