Java Reference
In-Depth Information
We now need to specify a number of options:
• It is a good idea to override the default name given to our session bean.
• We need to specify the package for our session bean.
• We need to specify the session bean type, stateless, stateful, or singleton:
° Stateful session beans maintain conversational state with the client
(which simply means that the values of any of their member variables
are in a consistent state between method calls).
° Stateless session beans don't maintain conversational state, for this
reason they perform better than stateful session beans.
° Singleton session beans are a new type of session bean introduced in
Java EE 6. A single instance of each singleton session bean is created
when our application is deployed. Singleton session beans are useful
to cache frequently read database data.
• We need to specify if our session bean will have a remote interface, which is
used for clients executing in a different JVM than our bean, a local interface,
which is meant for clients running in the same JVM as our bean, or both a
remote and a local interface.
A new feature of Java EE 6 is that local interfaces are optional. Therefore it isn't
necessary to create any interface for our session beans if it will only be accessed by
clients executing in the same JVM.