Am I right that if I use stateless session bean which is
calling a stored procedure, commit done in stored procedure
can not be rolled back in session bean?
What is the best practice to handle commits and rollbacks
if there is a stateless session bean (as a facade to client) calling one or maybe multiple stored procedures?
you must deploy the container's method-------setRollBackOnly() and the transaction is container manager.
Use a Session bean with a bean managed persistence option. If you are using an IDE like WSAD, you can create a Session Bean with the bean manager persistence option.
Usually the best practices to use in your scenario would be to use a Data Access helper class (which in turn may use a data source) performing all the DB operations and based on the result of each atomic transaction the session EJB will commit/rollback. DO NOT HAVE COMMIT LOGIC INSIDE A SP. Its a bad practice in a N-tier EJB design.
So, if I use Bean managed persistence, not CMP, should my Session bean
calling SP use JTA for starting transaction, commiting and rollbacking ?
...Or is Container managed persistence (REQUIRED attribute)
better choice for transaction handling in session bean when using SP?
Has anyone any experience using EJB/SP ? Please, tell what kind of
soulutions you made.