As a point of comparison, I set up a test using OpenJPA. A combination of lock mode, limit, and order by results in the following 2 queries:
SELECT * FROM (SELECT t0.id, t0.description, t0.sequence, t0.x, t0.y FROM DataPoint t0 ORDER BY t0.id DESC) WHERE ROWNUM <= ?
SELECT t0.id FROM DataPoint t0 WHERE t0.id = ? FOR UPDATE
Note that there is no locking between the 2, then each result is locked. This doesn't seem optimal.
As a point of comparison, I set up a test using OpenJPA. A combination of lock mode, limit, and order by results in the following 2 queries:
SELECT * FROM (SELECT t0.id, t0.description, t0.sequence, t0.x, t0.y FROM DataPoint t0 ORDER BY t0.id DESC) WHERE ROWNUM <= ?
SELECT t0.id FROM DataPoint t0 WHERE t0.id = ? FOR UPDATE
Note that there is no locking between the 2, then each result is locked. This doesn't seem optimal.