4 Replies Latest reply on Oct 10, 2002 11:37 AM by Alexey Loubyansky

    Transactions and deletions

    Glenn Lewis Newbie

      Hi All,

      Specs: JBoss 3.0.3, Postgress 7.2, java 1.4

      Problem: I have a CMP bean that uses BMT. I have two user transactions. One deletes an entity from the database, the other does a findAll. My problem is that the findAll is returning the entity that has been deleted (even though they are within transactions). Can anyone tell me how I might fix this?

      I have been searching the web for days. Do I need to set the transaction isolation level? If so how/where is that done? or do I need to set the row-locking to true for the bean in jbosscmp-jdbc? (I tried this, but it didn't deploy properly with this line added). Or do I need to do something else???

      Any help is *very* much appreciated!

      Thanks

      --
      Glenn




        • 1. Re: Transactions and deletions
          Glenn Lewis Newbie

          > or do I need to set the row-locking to
          > true for the bean in jbosscmp-jdbc? (I tried this,
          > but it didn't deploy properly with this line added).
          > Or do I need to do something else???

          Sorry, I made a mistake in the jbosscmp-jdbc file. It now deploys and the bean uses row-locking.

          **HOWEVER** my original problem remains :( Any suggestions?

          --
          Glenn

          • 2. Re: Transactions and deletions
            Alexey Loubyansky Master

            First, only session and message driven beans can define transaction type. All entities have transaction-type Container by the spec.
            As to your problem, are you sure the transaction that removed entity is finished before the findAll is called?

            • 3. Re: Transactions and deletions
              Glenn Lewis Newbie

              > First, only session and message driven beans can
              > define transaction type.

              Sorry, I think I mislead you in my original post. I am using a session bean, with user transactions. These transactions call methods on CMP Entity beans.

              > All entities have
              > transaction-type Container by the spec.
              > As to your problem, are you sure the transaction that
              > removed entity is finished before the findAll is
              > called?

              No, I don't think it is. I believe that is the problem ... I want the database to locked until the first transaction completes. I'm not sure what I need to set for this to happen in JBoss?

              --
              Glenn




              • 4. Re: Transactions and deletions
                Alexey Loubyansky Master

                If you mean transaction serialization it is set up in data source configuration. You can look at examples for, say, Oracle.
                Or post your questions in the jboss use list. I don't have much experience with it.