1 Reply Latest reply on Oct 4, 2010 11:19 AM by Marcelo Piriz

    Concurrency problem:

    Marcelo Piriz Newbie
      
      
      

      I have the following situation:

      I'm using JBoss 5.0, hibernate 3.3.2 and Oracle 10g xe.

       

      The problem is when 2 clients A, B call at same time the m method.

      Basically when call the method m to make a change in a field1 in the base, this method read the value first from the base then it change the value at field1.

       

      The client A check that a field1 has a value and then when a client B call the same m method at the same time, verified and change the field1.

      Next when a client A change the value in data base the field1 has a fail value when the operations finish.

      Jboss mix the sql query from 2 invocations, then send to the base the queries mixed.

      I try to put in the serializable-isolation level value in the hibernate configuration in the proyect (Persistence.xml) for solve the problem but not work.

      I put serializable-isolation level for test only.

      I don't know is a hibernate problem or a Jboss bug, because is at end of the transaction and the beginning of hibernate job to tuning the queries and send the queries bad mixed to the base.

      Thanks in advance,

      Marcelo

       

      P.D: This is a example of the log that generate when making the concurrency.

       

      2010-05-19 16:22:58,859 INFO  [STDOUT] (http-0.0.0.0-9090-2) pepepepeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
      2010-05-19 16:22:58,875 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: select * from ( select count(av0_.NAME) as col_0_0_ from AV av0_ where av0_.NAME=? ) where rownum <= ?
      2010-05-19 16:22:58,906 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: select SQ_AV.nextval from dual
      2010-05-19 16:22:59,031 INFO  [STDOUT] (http-0.0.0.0-9090-6) pepepepeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
      2010-05-19 16:22:59,031 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: select * from ( select count(av0_.NAME) as col_0_0_ from AV av0_ where av0_.NAME=? ) where rownum <= ?
      2010-05-19 16:22:59,062 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: select SQ_AV.nextval from dual
      2010-05-19 16:22:59,156 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: insert into AV (NAME, TAV, CODE) values (?, ?, ?)
      2010-05-19 16:22:59,156 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: insert into AV (NAME, TAV, CODE) values (?, ?, ?)
      2010-05-19 16:22:59,171 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: insert into TITLETOT (CODAV) values (?)
      2010-05-19 16:22:59,187 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: insert into TITLETOT (CODAV) values (?)
      2010-05-19 16:22:59,234 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: select per1_.CODIGO as CODIGO12_....
      2010-05-19 16:22:59,250 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: select per1_.CODIGO as CODIGO12_....
      2010-05-19 16:22:59,343 INFO  [STDOUT] (http-0.0.0.0-9090-2) Hibernate: update PER set NAME=?, TPER=?, CODTITLETOT=? where CODE=?
      2010-05-19 16:22:59,343 INFO  [STDOUT] (http-0.0.0.0-9090-6) Hibernate: update PER set NAME=?, TPER=?, CODTITLETOT=? where CODE=?