Update n number of records using JPA with Optimistic locking

Posted by Jacques René Mesrine on Stack Overflow See other posts from Stack Overflow or by Jacques René Mesrine
Published on 2010-05-04T01:49:15Z Indexed on 2010/05/04 1:58 UTC
Read the original article Hit count: 484

Filed under:
|
|
|
|

I have a table with a column called "count" and I want to run a cron job that will trigger a statement that performs a SQL like this:

update summaryTable set count=4;

Note that there might be concurrent threads reading & changing the value for "count" when this cron job is triggered. The table has a version column to support Optimistic Locking.

What's an efficient way to update the count in JPA ?

© Stack Overflow or respective owner

Related posts about jpa

Related posts about mysql