mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#2113 - Refactor rename Query.ForUpdate to Query.LockWait
Slightly improve the name of the enum. Note that although this is on public Query it's only internally used.
This commit is contained in:
@@ -237,7 +237,7 @@ public interface SpiQuery<T> extends Query<T>, TxnProfileEventCodes {
|
||||
* Return the ForUpdate mode.
|
||||
*/
|
||||
@Override
|
||||
ForUpdate getForUpdateMode();
|
||||
LockWait getForUpdateLockWait();
|
||||
|
||||
/**
|
||||
* Return the bean descriptor for this query.
|
||||
|
||||
@@ -783,7 +783,7 @@ class CQueryBuilder {
|
||||
* Return the 'for update' FROM hint (sql server).
|
||||
*/
|
||||
String fromForUpdate(SpiQuery<?> query) {
|
||||
Query.ForUpdate mode = query.getForUpdateMode();
|
||||
Query.LockWait mode = query.getForUpdateLockWait();
|
||||
if (mode == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -580,7 +580,7 @@ class DefaultFetchGroupQuery<T> implements SpiFetchGroupQuery<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForUpdate getForUpdateMode() {
|
||||
public LockWait getForUpdateLockWait() {
|
||||
throw new RuntimeException("EB102: Only select() and fetch() clause is allowed on FetchGroup");
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
*/
|
||||
private Boolean autoTune;
|
||||
|
||||
private ForUpdate forUpdate;
|
||||
private LockWait forUpdate;
|
||||
private LockType lockType;
|
||||
|
||||
private boolean singleAttribute;
|
||||
@@ -965,35 +965,35 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
|
||||
@Override
|
||||
public DefaultOrmQuery<T> forUpdate() {
|
||||
return setForUpdateWithMode(ForUpdate.BASE, LockType.Default);
|
||||
return setForUpdateWithMode(LockWait.WAIT, LockType.Default);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> forUpdate(LockType lockType) {
|
||||
return setForUpdateWithMode(ForUpdate.BASE, lockType);
|
||||
return setForUpdateWithMode(LockWait.WAIT, lockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> forUpdateNoWait(LockType lockType) {
|
||||
return setForUpdateWithMode(ForUpdate.NOWAIT, lockType);
|
||||
return setForUpdateWithMode(LockWait.NOWAIT, lockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Query<T> forUpdateSkipLocked(LockType lockType) {
|
||||
return setForUpdateWithMode(ForUpdate.SKIPLOCKED, lockType);
|
||||
return setForUpdateWithMode(LockWait.SKIPLOCKED, lockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultOrmQuery<T> forUpdateNoWait() {
|
||||
return setForUpdateWithMode(ForUpdate.NOWAIT, LockType.Default);
|
||||
return setForUpdateWithMode(LockWait.NOWAIT, LockType.Default);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultOrmQuery<T> forUpdateSkipLocked() {
|
||||
return setForUpdateWithMode(ForUpdate.SKIPLOCKED, LockType.Default);
|
||||
return setForUpdateWithMode(LockWait.SKIPLOCKED, LockType.Default);
|
||||
}
|
||||
|
||||
private DefaultOrmQuery<T> setForUpdateWithMode(ForUpdate mode, LockType lockType) {
|
||||
private DefaultOrmQuery<T> setForUpdateWithMode(LockWait mode, LockType lockType) {
|
||||
this.forUpdate = mode;
|
||||
this.lockType = lockType;
|
||||
this.useBeanCache = CacheMode.OFF;
|
||||
@@ -1006,7 +1006,7 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForUpdate getForUpdateMode() {
|
||||
public LockWait getForUpdateLockWait() {
|
||||
return forUpdate;
|
||||
}
|
||||
|
||||
@@ -1146,6 +1146,9 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
|
||||
}
|
||||
if (forUpdate != null) {
|
||||
sb.append(",forUpd:").append(forUpdate.ordinal());
|
||||
if (lockType != null) {
|
||||
sb.append(",lt:").append(lockType.ordinal());
|
||||
}
|
||||
}
|
||||
if (id != null) {
|
||||
sb.append(",id:");
|
||||
|
||||
Reference in New Issue
Block a user