Add usingMaster() to SqlQuery.TypeQuery (#3744)

This commit is contained in:
Rob Bygrave
2026-04-12 12:49:39 +12:00
committed by GitHub
parent 794f933310
commit c4230c780f
2 changed files with 20 additions and 0 deletions
@@ -367,6 +367,14 @@ public interface SqlQuery extends Serializable, CancelableQuery {
*/
interface TypeQuery<T> {
/**
* Ensure the master DataSource is used when useMaster is true. Otherwise, the read only
* data source can be used if defined.
*
* @see SqlQuery#usingMaster(boolean)
*/
TypeQuery<T> usingMaster(boolean useMaster);
/**
* Execute the query using the given transaction.
*/
@@ -269,6 +269,12 @@ public final class DefaultRelationalQuery extends AbstractQuery implements SpiSq
this.type = type;
}
@Override
public TypeQuery<T> usingMaster(boolean useMaster) {
DefaultRelationalQuery.this.usingMaster(useMaster);
return this;
}
@Override
public TypeQuery<T> usingTransaction(Transaction transaction) {
transaction(transaction);
@@ -308,6 +314,12 @@ public final class DefaultRelationalQuery extends AbstractQuery implements SpiSq
this.mapper = mapper;
}
@Override
public TypeQuery<T> usingMaster(boolean useMaster) {
DefaultRelationalQuery.this.usingMaster(useMaster);
return this;
}
@Override
public TypeQuery<T> usingTransaction(Transaction transaction) {
transaction(transaction);