Thursday, April 7, 2016

EJB : Stateless vs Singleton and in particular this answer
The EXCELLENT book "Beginning EJB 3: Java EE 7 Edition" (that I highly recommend to buy) explains it very well:
"Introduced in EJB 3.1, a singleton session bean is a session bean component that is instantiated only once per application. For an application, only one instance of a singleton session bean can ever exist. Once instantiated, a singleton session bean lives for the full duration of the application. The singleton session bean maintains its state between client invocations, but it cannot save that state after a container shutdown or crash. Similar to stateless and stateful session beans, the singleton session bean is comprised of a bean class and, optionally, one or more business interfaces."

No comments: