0 Replies Latest reply on May 2, 2006 3:47 AM by Dani Belz

    Locking strategy

    Dani Belz Newbie


      I just wanted to know, what the default locking strategy in JBoss is.
      Am I right, that when I do a EJBQL/JBossQL/DeclaredSQL finder, the
      returned database entries are locked for reading until the transaction
      is finished?

      Why this is important to know for me:
      I have a table that represents 'ressources' that can be used. Let's assume
      one thread wants to have one and calls the finder. The finder returnes one
      ressource table entry of e.g. 5 available.

      Now, if another thread also wants a ressource and therefore calls the
      finder -- will it find the same ressource again? Or does JBoss lock this
      entry in a way that the second thread gets one of the 4 remaining

      How about race conditions when both thread try to run the finder at the
      same time?

      Can anyone help me out here? I just want to make sure my application
      is thread safe :-) Thanks!