Add support for Postgres lock types (no key, share, key share) with FOR UPDATE

This commit is contained in:
rob bygrave
2020-11-24 23:36:54 +13:00
parent f4ea674d60
commit 5c34b0daa5
16 changed files with 207 additions and 41 deletions
@@ -686,24 +686,39 @@ public abstract class TQRootBean<T, R> {
}
/**
* executed the select with "for update" which should lock the record "on read"
* Execute using "for update" clause which results in the DB locking the record.
*/
public R forUpdate() {
query.forUpdate();
return root;
}
/**
* Execute using "for update" with given lock type (currently Postgres only).
*/
public R forUpdate(Query.LockType lockType) {
query.forUpdate(lockType);
return root;
}
/**
* Execute using "for update" clause with "no wait" option.
* <p>
* This is typically a Postgres and Oracle only option at this stage.
* </p>
*/
public R forUpdateNoWait() {
query.forUpdateNoWait();
return root;
}
/**
* Execute using "for update nowait" with given lock type (currently Postgres only).
*/
public R forUpdateNoWait(Query.LockType lockType) {
query.forUpdateNoWait(lockType);
return root;
}
/**
* Execute using "for update" clause with "skip locked" option.
* <p>
@@ -715,6 +730,14 @@ public abstract class TQRootBean<T, R> {
return root;
}
/**
* Execute using "for update skip locked" with given lock type (currently Postgres only).
*/
public R forUpdateSkipLocked(Query.LockType lockType) {
query.forUpdateSkipLocked(lockType);
return root;
}
/**
* Return this query as an UpdateQuery.
*