1 Reply Latest reply on Dec 1, 2004 2:50 AM by Alexey Loubyansky

    Transaction lost in cluster

    Ole Sandum Newbie

      Hi all

      We are currently "clusterizing" an existing application on 3.2.6 (it was born on JBoss 3.0 and has grown to about 80 entity beans and 50 session beans). After having deployed on two servers in the "all" configuration, we experience problems with transactional integrity.

      In particular, we have a piece of sessionbean code like this:

       * @ejb:interface-method
       * @ejb:transaction type="RequiresNew"
      public void sendReminderMail(AuctionEntityPK pk)
       throws Exception
       Date now = SQLHelper.getDatabaseNow();
       LocalAuctionEntity auction = m_auctionEntityHome.findByPrimaryKey(pk);
       if (auction.getReminderMailSentDate() != null)
       // (imagine code to compose and send mail here)

      It is run at short intervals by a timer. It should only be run on a single server, but it should still be robust against being run repeatedly or concurrently, hence the check on the date stamp. Now, if two beans were to call it with the same pk at the same time, I would expect one of them to throw TransactionRolledbackException. This does not seem to happen. Why?

      The entity bean uses optimistic locking with a version column. This is its container config:

      <container-configuration extends="Instance Per Transaction CMP 2.x EntityBean">
       <container-name>Optimistic CMP EntityBean</container-name>

      The database is Oracle.

      /Ole Sandum