1 Reply Latest reply on Oct 22, 2002 2:44 PM by Adrian Brock

    MBean / EJB / Transaction problem

    Michael Bernards Newbie

      Hi there,

      I'm completly new in EJB/JBoss. It was possible to me to set up JBoss 3.0.3 on Linux using Oracle 8i for persistence. I used the Template examples to build a test application with 2 entity beans (BMT), one session bean (stateless) and a JSP as testing frontend. This works fine.

      Then I builded a managed bean. It act as a jms receiver (PtP). The session bean does its operations with the entity beans and calls the mbean via message, gets an answer, commits the UserTransaction und finishes.

      So far so good. I wonder now, if it is possible to make some of database actions in the mbean (or use a entity bean from the mbean) within the UserTransaction of the session bean.

      Does anyone know something about this?

      Regards, Michael

        • 1. Re: MBean / EJB / Transaction problem
          Adrian Brock Master

          The transaction is attached to the thread
          during

          userTransaction.begin();

          Your MBean will run on different thread,
          the one provided by JMS to deliver the message.
          It will not take part in the original transaction.

          I would think about what you are trying to do.
          If you need the work doing in the same transaction why
          are you doing asynchronous work with no guarantee of
          when it is performed?

          Long running transactions are bad because the
          entities are locked until the transaction is committed.

          Regards,
          Adrian