2 Replies Latest reply on Dec 5, 2003 11:36 AM by jfraser

    mySQL/Isolation/concurrent update

    zahid14

      I am having a entity bean which provides sequence number to its caller. It simply increments(setId(getId()+1) the number after each access but in case of concurrent access to it the multiple caller are gettting the same value. I assume, JBoss, by default provides Serialize isolation but I saw multiple threads getting the same value. It happens ONLY when multiple callers are accessing the bean, when load is less it works fine.
      I also put RequiresNew transaction but it did not help.
      Any help to make sure it provides unique number will be appreciated.

      Thanks in advance

        • 1. Re: mySQL/Isolation/concurrent update
          radl01

          Hi,

          Do you need to generate a unique ID from DB?. We use another solution with SSB with static block. This is very fast method because the SSB should be pooled.

          An other way is to generate ID from timestamp (System.getCurrentTimeMillis()) or generate UUID format from ip and time. This is the best way in case of clusters.

          Jan

          • 2. Re: mySQL/Isolation/concurrent update
            jfraser

            What about the transaction isolation setting of the database itself? I set it to Read_Committed (not an exact term) in the my.ini file. and then set the same value in the mysql-ds.xml file. I have attached my files, and I hope it helps.

            JOE