mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
#1626 - ENH: Add SqlUpdate.setParams(Object ... ) and SqlQuery.setParams(Object ... ) ... as convenient alternative to many setParameter() calls
This commit is contained in:
1 parent
5cef1ad017
commit
961a7ef7ea
5 files changed
+91
No files matched your search
@@ -34,6 +34,11 @@ public class DefaultRelationalQuery implements SpiSqlQuery {
|
||||
|
||||
private int bufferFetchSizeHint;
|
||||
|
||||
/**
|
||||
* Helper to add positioned parameters in order.
|
||||
*/
|
||||
private int addPos;
|
||||
|
||||
/**
|
||||
* Bind parameters when using the query language.
|
||||
*/
|
||||
@@ -107,6 +112,14 @@ public class DefaultRelationalQuery implements SpiSqlQuery {
|
||||
return Optional.ofNullable(findOne());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultRelationalQuery setParams(Object... values) {
|
||||
for (Object value : values) {
|
||||
setParameter(++addPos, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DefaultRelationalQuery setParameter(int position, Object value) {
|
||||
bindParams.setParameter(position, value);
|
||||
|
||||
Reference in new issue
Block a user