Commits and rollbacks in EJB/SP


EJB design: Commits and rollbacks in EJB/SP

  1. Commits and rollbacks in EJB/SP (4 messages)


    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?


    Threaded Messages (4)

  2. saasdfa[ Go to top ]

    you must deploy the container's method-------setRollBackOnly() and the transaction is container manager.
  3. Use CMP[ Go to top ]

    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.

  4. If BMP[ Go to top ]

    So, if I use Bean managed persistence, not CMP, should my Session bean
    calling SP use JTA for starting transaction, commiting and rollbacking ?


  5. ...or CMP[ Go to top ]

    ...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.