Problem solve Get help with specific problems with your technologies, process and projects.

How do I change a stateless session bean into a stateful session bean?

How do I change a stateless session bean into a stateful session bean?
The primary design difference between a version 2.x stateful EJB and a stateless EJB is the state information is typically stored in the stateful EJB's member fields, whereas no state information should be saved in the stateless EJB.

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-class> com.jeffhanson.ejb.MyEJBBean</ejb-class>
Now to turn this into a stateful EJB deployment, we just need to modify the "session-type" element to read:


This was last published in November 2004

Dig Deeper on REST and microservices



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.