-
1. Re: Stateful session bean is not necessary?
minamoto Nov 27, 2001 12:45 AM (in response to ipozeng)When you use a stateful session bean, you can take advantage of EJB features:
1) Session beans are distributed objects
While only servlets/JSPs can access session objects in a web container, normal Java clients can access session beans.
If the EJB server supports RMI-IIOP, even C++ client can access EJBs.
2) Session beans can control transaction demarcation
We can change transactional behavior of the stateful session bean without changing the source.
You just change the ejb-jar.xml. Even if you can implement listAll() method of JavaBeans + UserTransaction,
it will not be flexible like EJB.
3) Stateful session beans can implement SessionSynchronization interface.
It supports usuful callback methods: afterBegin, beforeCompletion and afterCompletion.
You can do something for your application at the end of the transaction.
Miki