What are the benefits of using a Stateless Session Bean over using a class purely consisting of static methods?

Dan Christopherson

Mostly container management of transactions and the ability to 'easily' call remote code. Really, the two solutions work at different scales: a Stateless Session Bean is useful when you can define a set of (fairly coarse grained) atomic transactions that are related by a common theme, where a bunch of static methods in a class are more useful for (rather fine grained) utility code.

One common use of Stateless Session Beans is to implement a facade over a set of entity beans, in order to allow the client to be transaction-ignorant. In this pattern the session bean defines a set of transactions that it implements using entity beans. See FAQ question "What is the Session wraps Entity Pattern? What are the motivations behind it?" for more information.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact