optimistic locking batch update

Posted by Priit on Stack Overflow See other posts from Stack Overflow or by Priit
Published on 2010-05-26T06:59:12Z Indexed on 2010/05/26 7:01 UTC
Read the original article Hit count: 313

Filed under:
|
|
|

How to use optimistic locking with batch updates? I am using SimpleJdbcTemplate and for single row I can build update sql that increments version column value and includes version in WHERE clause.

Unfortunately te result int[] updated = simpleJdbcTemplate.batchUpdate does not contain rowcounts when using oracle driver. All elements are -2 indicating unknown rowcount.

Is there some other, more performant way of doing this than executing all updates individually? These batches contain an average of 5 items (only) but may be up to 250.

© Stack Overflow or respective owner

Related posts about java

Related posts about jdbc