Class DefaultUpdateQuery<T>

    • Method Detail

      • set

        public UpdateQuery<Tset​(String property,
                                  Object value)
        Description copied from interface: UpdateQuery
        Set the value of a property.

        
        
           int rows = DB.update(Customer.class)
              .set("status", Customer.Status.ACTIVE)
              .set("updtime", new Timestamp(System.currentTimeMillis()))
              .where()
              .gt("id", 1000)
              .update();
        
         
        Specified by:
        set in interface UpdateQuery<T>
        Parameters:
        property - The bean property to be set
        value - The value to set the property to
      • setNull

        public UpdateQuery<TsetNull​(String property)
        Description copied from interface: UpdateQuery
        Set the property to be null.

        
        
           int rows = DB.update(Customer.class)
              .setNull("notes")
              .where()
              .gt("id", 1000)
              .update();
        
         
        Specified by:
        setNull in interface UpdateQuery<T>
        Parameters:
        property - The property to be set to null.
      • setRaw

        public UpdateQuery<TsetRaw​(String propertyExpression)
        Description copied from interface: UpdateQuery
        Set using a property expression that does not need any bind values.

        The property expression typically contains database functions.

        
        
           int rows = DB.update(Customer.class)
              .setRaw("status = coalesce(status, 'A')")
              .where()
              .gt("id", 1000)
              .update();
        
         
        Specified by:
        setRaw in interface UpdateQuery<T>
        Parameters:
        propertyExpression - A property expression
      • setRaw

        public UpdateQuery<TsetRaw​(String propertyExpression,
                                     Object... vals)
        Description copied from interface: UpdateQuery
        Set using a property expression that can contain ? bind value placeholders.

        For each ? in the property expression there should be a matching bind value supplied.

        
        
           int rows = DB.update(Customer.class)
              .setRaw("status = coalesce(status, ?)", Customer.Status.ACTIVE)
              .where()
              .gt("id", 1000)
              .update();
        
         
        Specified by:
        setRaw in interface UpdateQuery<T>
        Parameters:
        propertyExpression - A raw property expression
        vals - The values to bind with the property expression
      • update

        public int update()
        Description copied from interface: UpdateQuery
        Execute the update returning the number of rows updated.
        Specified by:
        update in interface UpdateQuery<T>