Class DefaultSqlUpdate
java.lang.Object
io.ebeaninternal.server.core.DefaultSqlUpdate
- All Implemented Interfaces:
io.ebean.SqlUpdate, SpiSqlUpdate, Serializable
A SQL Update Delete or Insert statement that can be executed. For the times
when you want to use Sql DML rather than a ORM bean approach. Refer to the
Ebean execute() method.
There is also Update which is similar except should use logical bean and
property names rather than physical table and column names.
SqlUpdate is designed for general DML sql and CallableSql is designed for use with stored procedures.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultSqlUpdate(SpiEbeanServer server, String sql) Create with a specific server.DefaultSqlUpdate(SpiEbeanServer server, String sql, BindParams bindParams) Create with server sql and bindParams object.DefaultSqlUpdate(String sql) Create with some sql. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()baseSql()Return the sql taking into account bind parameter expansion.Return the bind parameters.copy()Return a copy of the SqlUpdate with empty bind parameters.intexecute()int[]intgetLabel()getSql()intbooleanbooleanReturn true if we are using getGeneratedKeys.voidreset()Reset bind position to be ready for another bind execute.io.ebean.SqlUpdatesetArrayParameter(String name, Collection<?> values) io.ebean.SqlUpdatesetAutoTableMod(boolean isAutoTableMod) voidsetGeneratedKey(Object idValue) Set the generated key value.voidsetGeneratedSql(String generatedSql) Set the final sql being executed with named parameters replaced etc.io.ebean.SqlUpdatesetGetGeneratedKeys(boolean getGeneratedKeys) io.ebean.SqlUpdateio.ebean.SqlUpdatesetNull(int position, int jdbcType) io.ebean.SqlUpdateio.ebean.SqlUpdatesetNullParameter(int position, int jdbcType) io.ebean.SqlUpdatesetNullParameter(String name, int jdbcType) io.ebean.SqlUpdatesetParameter(int position, Object value) io.ebean.SqlUpdatesetParameter(Object value) io.ebean.SqlUpdatesetParameter(String name, Object param) io.ebean.SqlUpdatesetParameters(Object... values) io.ebean.SqlUpdatesetTimeout(int secs)
-
Constructor Details
-
DefaultSqlUpdate
Create with server sql and bindParams object.Useful if you are building the sql and binding parameters at the same time.
-
DefaultSqlUpdate
Create with a specific server. This means you can use the SqlUpdate.execute() method. -
DefaultSqlUpdate
Create with some sql.
-
-
Method Details
-
copy
Description copied from interface:SpiSqlUpdateReturn a copy of the SqlUpdate with empty bind parameters.- Specified by:
copyin interfaceSpiSqlUpdate
-
reset
public void reset()Description copied from interface:SpiSqlUpdateReset bind position to be ready for another bind execute.- Specified by:
resetin interfaceSpiSqlUpdate
-
executeGetKey
- Specified by:
executeGetKeyin interfaceio.ebean.SqlUpdate
-
execute
public int execute()- Specified by:
executein interfaceio.ebean.SqlUpdate
-
executeNow
public int executeNow()- Specified by:
executeNowin interfaceio.ebean.SqlUpdate
-
executeBatch
public int[] executeBatch()- Specified by:
executeBatchin interfaceio.ebean.SqlUpdate
-
addBatch
public void addBatch()- Specified by:
addBatchin interfaceio.ebean.SqlUpdate
-
getGeneratedKey
- Specified by:
getGeneratedKeyin interfaceio.ebean.SqlUpdate
-
setGeneratedKey
Description copied from interface:SpiSqlUpdateSet the generated key value.- Specified by:
setGeneratedKeyin interfaceSpiSqlUpdate
-
isAutoTableMod
public boolean isAutoTableMod()- Specified by:
isAutoTableModin interfaceio.ebean.SqlUpdate
-
setAutoTableMod
public io.ebean.SqlUpdate setAutoTableMod(boolean isAutoTableMod) - Specified by:
setAutoTableModin interfaceio.ebean.SqlUpdate
-
getLabel
- Specified by:
getLabelin interfaceio.ebean.SqlUpdate
-
setLabel
- Specified by:
setLabelin interfaceio.ebean.SqlUpdate
-
isGetGeneratedKeys
public boolean isGetGeneratedKeys()Description copied from interface:SpiSqlUpdateReturn true if we are using getGeneratedKeys.- Specified by:
isGetGeneratedKeysin interfaceSpiSqlUpdate
-
setGetGeneratedKeys
public io.ebean.SqlUpdate setGetGeneratedKeys(boolean getGeneratedKeys) - Specified by:
setGetGeneratedKeysin interfaceio.ebean.SqlUpdate
-
getGeneratedSql
- Specified by:
getGeneratedSqlin interfaceio.ebean.SqlUpdate
-
setGeneratedSql
Description copied from interface:SpiSqlUpdateSet the final sql being executed with named parameters replaced etc.- Specified by:
setGeneratedSqlin interfaceSpiSqlUpdate
-
getSql
- Specified by:
getSqlin interfaceio.ebean.SqlUpdate
-
baseSql
Description copied from interface:SpiSqlUpdateReturn the sql taking into account bind parameter expansion.- Specified by:
baseSqlin interfaceSpiSqlUpdate
-
getTimeout
public int getTimeout()- Specified by:
getTimeoutin interfaceio.ebean.SqlUpdate
-
setTimeout
public io.ebean.SqlUpdate setTimeout(int secs) - Specified by:
setTimeoutin interfaceio.ebean.SqlUpdate
-
setParameters
- Specified by:
setParametersin interfaceio.ebean.SqlUpdate
-
setParameter
- Specified by:
setParameterin interfaceio.ebean.SqlUpdate
-
setParameter
- Specified by:
setParameterin interfaceio.ebean.SqlUpdate
-
setNull
public io.ebean.SqlUpdate setNull(int position, int jdbcType) - Specified by:
setNullin interfaceio.ebean.SqlUpdate
-
setNullParameter
public io.ebean.SqlUpdate setNullParameter(int position, int jdbcType) - Specified by:
setNullParameterin interfaceio.ebean.SqlUpdate
-
setParameter
-
setArrayParameter
- Specified by:
setArrayParameterin interfaceio.ebean.SqlUpdate
-
setNull
- Specified by:
setNullin interfaceio.ebean.SqlUpdate
-
setNullParameter
- Specified by:
setNullParameterin interfaceio.ebean.SqlUpdate
-
bindParams
Return the bind parameters.- Specified by:
bindParamsin interfaceSpiSqlUpdate
-