Session beans
Like we previously mentioned, session beans typically encapsulate business logic. In Java EE, only one or two artifacts need to be created in order to create a session bean: the bean itself, and an optional business interface. These artifacts need to be decorated with the proper annotations to let the EJB container know they are session beans.
Note
J2EE required application developers to create several artifacts in order to create a session bean. These artifacts include the bean itself, a local or remote interface (or both), a local home or a remote home interface (or both), and an XML deployment descriptor. As we shall see in this chapter, EJB development was greatly simplified in Java EE.
A simple session bean
The following example illustrates a very simple session bean.:
package net.ensode.javaeebook;
import javax.ejb.Stateless;
@Stateless
public class SimpleSessionBean implements SimpleSession
{
private String message =
"If you don't see this, it didn't work!";
...