mihalcea_vlad wrote:
And what if by chance two selects will fetch the same row because both used the same random value?
I am trying to prevent such conflicts on best-efforts basis, also in our case we have lots of rows which satisfy our select query(typically about 10000 rows) so I believe that the probability of such situations are very low.
mihalcea_vlad wrote:
I understand what you are trying to do. I don;t understand what is the actual reason for doing such a hack. Is it related to concurrency control? Do you plan on modifying thos eentities and you don't want a conflict? There are better ways to solve such a requirement
Yes exactly, the fetched rows are going to be modified and an update query will be sent to DB. We are using Optimistic Lock by hibernate to prevent conflicts.
Note that I am forced not to use pessimistic lock.
What is your suggestion?
Thanks
Pedram