java - How to make DB return different rows for subsequent transactions? -


I have the following flows in a multi-threaded environment

  1. Start the transaction
  2. Update those sets of rows
  3. committed / rollback
  4. transactions

I I'm using optimistic locking to handle multi-threaded scenarios, but in the above situation, DB is always returning the same set of rows, so if the second thread runs at the same time always Successful.

Is there a better way to handle this? Can we force DB to return different rows for each transaction using some options?

(atomicity, stability, etc.) I get the same top n record for all threads due to , separation, durability) theory of transaction separation means that other operations can not access such data Which has been modified during a transaction that has not yet been completed. So unless your threads do their transactions, other threads can not see what they have done.

It is possible to change on most databases for one of the following:

  • Recommended
  • Read < / Li>
  • Read
  • Unread unread

In your case, you may want to read that it is impossible to read because it is a transaction with some other transactions Allows to see the ungraded changes made by

Note: This is almost certainly the wrong isolation level for most applications, and this can lead to data corruption. If you do not want to change the same database other than any other application described herein you might not want to change the isolation level because those applications may seem to look unpredictable and incorrect behaviors.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -