mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Add support for Postgres lock types (no key, share, key share) with FOR UPDATE
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user