December 2017
Intermediate to advanced
372 pages
8h 46m
English
The following example illustrates a very simple session bean.:
package net.ensode.javaeebook;import javax.ejb.Stateless;@Statelesspublic class SimpleSessionBean implements SimpleSession{ private String message = "If you don't see this, it didn't work!"; public String getMessage() { return message; }}
The @Stateless annotation lets the EJB container know that this class is a stateless session bean. There are three types of session bean: stateless, stateful, and singleton. Before we explain the difference between these types of session bean, we need to clarify how an instance of an EJB is provided to an EJB client application.
When a stateless session bean is deployed, the EJB container creates a series of instances ...