The primary implementation difference between the two is the information specified in the EJB's deployment descriptor file (ejb-jar.xml). For example, a typical ejb-jar.xml file for a stateless EJB might look like the following:
<ejb-jar> <enterprise-beans> <session> <ejb-name>MyEJB</ejb-name> <home>com.jeffhanson.ejb.MyEJBHome</home> <remote>com.jeffhanson.ejb.MyEJB</remote> <ejb-class> com.jeffhanson.ejb.MyEJBBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> </session> </enterprise-beans> ... </ejb-jar>Now to turn this into a stateful EJB deployment, we just need to modify the "session-type" element to read:
Dig deeper on Java Web Services
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.