3 Replies Latest reply on Apr 2, 2002 9:53 AM by adrian.brock

    duplicate entries in db

    plewis66

      For something we really believe shouldn't happen...

      We have an entity, and a process that runs in batches creating instances of this entity.

      The process checks to see whether anything in the dB should cause a conflict with the entity about to be created - not on the primary key, but on the value in a (string) field.

      However, the process is resulting in rows in the database with duplicate values in this string field.

      Now we can probably get round this by changing the schema a bit, but I am interested to know how this could be happening.

      Any thoughts would be helpful. We are using TRANSACTION_READ_COMMITTED, and the process has transaction-attribute required, the entity transaction-attribute supports. The process component (session bean) is called repeatedly by a Servlet.

      Ta

      Phil

        • 1. Re: duplicate entries in db

          Look at the javadoc for javax.sql.Connection

          If I understand what you are doing,
          you want TRANSACTION_SERIALIZABLE
          to stop another transaction inserting a record
          after your select statement that would have been
          retrieved.

          All you are doing, is not seeing uncommitted records.

          Regards,
          Adrian

          • 2. Re: duplicate entries in db
            plewis66

            Thanks for that....erm...

            Could you tell me where I set it?

            I have set it in jboss.jcml in XADataSourceLoader>>TransactionIsolation, but I a still experiencing the same problem.

            In Weblogic, this is set in weblogic-ejb-jar.xml on a per bean basis, but there does not seem to be an equivalent setting available in jboss.xml.

            Thanks

            Phil



            • 3. Re: duplicate entries in db

              Does your database support that isolation level?

              Try using getTransactionIsolation() to see what
              level of isolation you get.

              Regards,
              Adrian