UserTransaction in EJB

Discussions

EJB programming & troubleshooting: UserTransaction in EJB

  1. UserTransaction in EJB (3 messages)

    Hi all,

    I am writing an EJB with BMP. I would like to know if I have to call any method in the UserTransaction object (that is used in the EJB) in the ejbPassivate/Activate methods as we have to release all the resources.
    I am not very sure if UserTransaction is a resource.

    Thanks,
    Srinivas.J

    Threaded Messages (3)

  2. Hi
       If you want to write beanmanaged transaction then you have to call methods on UserTransaction object.
    bye
    Rama
  3. Hi,
    I have used the begin, commit, rollback methods of the transaction.
    In ejbactivate/passivate methods we have to release system resources like connections, files etcs and get back the resources when activated.

    Should I release & restore UserTransaction also in ejbactivate/passivate?
  4. UserTransaction in EJB[ Go to top ]

    You can only use BMT with session beans, not entity beans.

    ejbActivate and ejbPassivate are not called by the container on stateless beans, only with stateful beans.

    You should definitely avoid doing TX control stuff in the ejbActivate and ejbPassivate methods. That is poor design!