Package io.ebean

Interface Update<T>

  • Type Parameters:
    T - the type of entity beans inserted updated or deleted

    public interface Update<T>
    An Insert Update or Delete statement.

    Generally a named update will be defined on the entity bean. This will take the form of either an actual sql insert update delete statement or a similar statement with bean name and property names in place of database table and column names. The statement will likely include named parameters.

    The following is an example of named updates on an entity bean.

    {@code
        ...
    • Method Detail

      • getName

        String getName()
        Return the name if it is a named update.
      • setNotifyCache

        Update<TsetNotifyCache​(boolean notifyCache)
        Set this to false if you do not want the cache to invalidate related objects.

        If you don't set this Ebean will automatically invalidate the appropriate parts of the "L2" server cache.

      • setTimeout

        Update<TsetTimeout​(int secs)
        Set a timeout for statement execution.

        This will typically result in a call to setQueryTimeout() on a preparedStatement. If the timeout occurs an exception will be thrown - this will be a SQLException wrapped up in a PersistenceException.

        Parameters:
        secs - the timeout in seconds. Zero implies unlimited.
      • execute

        int execute()
        Execute the statement returning the number of rows modified.
      • set

        Update<Tset​(int position,
                      Object value)
        Set an ordered bind parameter.

        position starts at value 1 (not 0) to be consistent with PreparedStatement.

        Set a value for each ? you have in the sql.

        Parameters:
        position - the index position of the parameter starting with 1.
        value - the parameter value to bind.
      • setParameter

        Update<TsetParameter​(int position,
                               Object value)
        Set and ordered bind parameter (same as bind).
        Parameters:
        position - the index position of the parameter starting with 1.
        value - the parameter value to bind.
      • setNull

        Update<TsetNull​(int position,
                          int jdbcType)
        Set an ordered parameter that is null. The JDBC type of the null must be specified.

        position starts at value 1 (not 0) to be consistent with PreparedStatement.

      • setNullParameter

        Update<TsetNullParameter​(int position,
                                   int jdbcType)
        Set an ordered parameter that is null (same as bind).
      • set

        Update<Tset​(String name,
                      Object value)
        Set a named parameter. Named parameters have a colon to prefix the name.

        A more succinct version of setParameter() to be consistent with Query.

        Parameters:
        name - the parameter name.
        value - the parameter value.
      • setNull

        Update<TsetNull​(String name,
                          int jdbcType)
        Set a named parameter that is null. The JDBC type of the null must be specified.

        A more succinct version of setNullParameter().

        Parameters:
        name - the parameter name.
        jdbcType - the type of the property being bound.
      • setLabel

        Update<TsetLabel​(String label)
        Set a label meaning performance metrics will be collected for the execution of this update.