Skip to main content

Posts

Showing posts with the label MDB

What is the differences between bean and ejb ?

A Java Bean is defined as an instance of a class that contains private attributes (data), and getter & setter methods. If you have: private String myString; in your class, you should have the methods public String getMyString (); and public void setMyString (String settingString); defined in your code. Although, I have found that it is not absolutely nessary to have everything defined; just don't be surprised if something breaks! An EJB (Enterprise Java Bean) is much more complex They only reside in application servers that handle EJBs (Tomcat doesn't hold EJBs). There are 3 types of EJBs: 1) Session Usually contain some business logic. 2) Entity Usually interface with a data store (such as a database). 3) Message-Driven Receives messages from JMS