Class DefaultSqlUpdate

java.lang.Object
io.ebeaninternal.server.core.DefaultSqlUpdate
All Implemented Interfaces:
io.ebean.SqlUpdate, SpiSqlUpdate, Serializable

public final class DefaultSqlUpdate extends Object implements Serializable, SpiSqlUpdate
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 Details

    • DefaultSqlUpdate

      public DefaultSqlUpdate(SpiEbeanServer server, String sql, BindParams bindParams)
      Create with server sql and bindParams object.

      Useful if you are building the sql and binding parameters at the same time.

    • DefaultSqlUpdate

      public DefaultSqlUpdate(SpiEbeanServer server, String sql)
      Create with a specific server. This means you can use the SqlUpdate.execute() method.
    • DefaultSqlUpdate

      public DefaultSqlUpdate(String sql)
      Create with some sql.
  • Method Details

    • copy

      public SpiSqlUpdate copy()
      Description copied from interface: SpiSqlUpdate
      Return a copy of the SqlUpdate with empty bind parameters.
      Specified by:
      copy in interface SpiSqlUpdate
    • reset

      public void reset()
      Description copied from interface: SpiSqlUpdate
      Reset bind position to be ready for another bind execute.
      Specified by:
      reset in interface SpiSqlUpdate
    • executeGetKey

      public Object executeGetKey()
      Specified by:
      executeGetKey in interface io.ebean.SqlUpdate
    • execute

      public int execute()
      Specified by:
      execute in interface io.ebean.SqlUpdate
    • executeNow

      public int executeNow()
      Specified by:
      executeNow in interface io.ebean.SqlUpdate
    • executeBatch

      public int[] executeBatch()
      Specified by:
      executeBatch in interface io.ebean.SqlUpdate
    • addBatch

      public void addBatch()
      Specified by:
      addBatch in interface io.ebean.SqlUpdate
    • getGeneratedKey

      public Object getGeneratedKey()
      Specified by:
      getGeneratedKey in interface io.ebean.SqlUpdate
    • setGeneratedKey

      public void setGeneratedKey(Object idValue)
      Description copied from interface: SpiSqlUpdate
      Set the generated key value.
      Specified by:
      setGeneratedKey in interface SpiSqlUpdate
    • isAutoTableMod

      public boolean isAutoTableMod()
      Specified by:
      isAutoTableMod in interface io.ebean.SqlUpdate
    • setAutoTableMod

      public io.ebean.SqlUpdate setAutoTableMod(boolean isAutoTableMod)
      Specified by:
      setAutoTableMod in interface io.ebean.SqlUpdate
    • getLabel

      public String getLabel()
      Specified by:
      getLabel in interface io.ebean.SqlUpdate
    • setLabel

      public io.ebean.SqlUpdate setLabel(String label)
      Specified by:
      setLabel in interface io.ebean.SqlUpdate
    • isGetGeneratedKeys

      public boolean isGetGeneratedKeys()
      Description copied from interface: SpiSqlUpdate
      Return true if we are using getGeneratedKeys.
      Specified by:
      isGetGeneratedKeys in interface SpiSqlUpdate
    • setGetGeneratedKeys

      public io.ebean.SqlUpdate setGetGeneratedKeys(boolean getGeneratedKeys)
      Specified by:
      setGetGeneratedKeys in interface io.ebean.SqlUpdate
    • getGeneratedSql

      public String getGeneratedSql()
      Specified by:
      getGeneratedSql in interface io.ebean.SqlUpdate
    • setGeneratedSql

      public void setGeneratedSql(String generatedSql)
      Description copied from interface: SpiSqlUpdate
      Set the final sql being executed with named parameters replaced etc.
      Specified by:
      setGeneratedSql in interface SpiSqlUpdate
    • getSql

      public String getSql()
      Specified by:
      getSql in interface io.ebean.SqlUpdate
    • baseSql

      public String baseSql()
      Description copied from interface: SpiSqlUpdate
      Return the sql taking into account bind parameter expansion.
      Specified by:
      baseSql in interface SpiSqlUpdate
    • getTimeout

      public int getTimeout()
      Specified by:
      getTimeout in interface io.ebean.SqlUpdate
    • setTimeout

      public io.ebean.SqlUpdate setTimeout(int secs)
      Specified by:
      setTimeout in interface io.ebean.SqlUpdate
    • setParameters

      public io.ebean.SqlUpdate setParameters(Object... values)
      Specified by:
      setParameters in interface io.ebean.SqlUpdate
    • setParameter

      public io.ebean.SqlUpdate setParameter(Object value)
      Specified by:
      setParameter in interface io.ebean.SqlUpdate
    • setParameter

      public io.ebean.SqlUpdate setParameter(int position, Object value)
      Specified by:
      setParameter in interface io.ebean.SqlUpdate
    • setNull

      public io.ebean.SqlUpdate setNull(int position, int jdbcType)
      Specified by:
      setNull in interface io.ebean.SqlUpdate
    • setNullParameter

      public io.ebean.SqlUpdate setNullParameter(int position, int jdbcType)
      Specified by:
      setNullParameter in interface io.ebean.SqlUpdate
    • setParameter

      public io.ebean.SqlUpdate setParameter(String name, Object param)
      Specified by:
      setParameter in interface io.ebean.SqlUpdate
    • setArrayParameter

      public io.ebean.SqlUpdate setArrayParameter(String name, Collection<?> values)
      Specified by:
      setArrayParameter in interface io.ebean.SqlUpdate
    • setNull

      public io.ebean.SqlUpdate setNull(String name, int jdbcType)
      Specified by:
      setNull in interface io.ebean.SqlUpdate
    • setNullParameter

      public io.ebean.SqlUpdate setNullParameter(String name, int jdbcType)
      Specified by:
      setNullParameter in interface io.ebean.SqlUpdate
    • bindParams

      public BindParams bindParams()
      Return the bind parameters.
      Specified by:
      bindParams in interface SpiSqlUpdate