Class DefaultUpdateQuery<T>
- java.lang.Object
-
- io.ebeaninternal.server.querydefn.DefaultUpdateQuery<T>
-
- All Implemented Interfaces:
UpdateQuery<T>
public class DefaultUpdateQuery<T> extends Object implements UpdateQuery<T>
Default implementation of UpdateQuery.
-
-
Constructor Summary
Constructors Constructor Description DefaultUpdateQuery(DefaultOrmQuery<T> query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdateQuery<T>
set(String property, Object value)
Set the value of a property.UpdateQuery<T>
setLabel(String label)
Set the label on the update query.UpdateQuery<T>
setNull(String property)
Set the property to be null.UpdateQuery<T>
setProfileLocation(ProfileLocation profileLocation)
Set the profile location of this update query.UpdateQuery<T>
setRaw(String propertyExpression)
Set using a property expression that does not need any bind values.UpdateQuery<T>
setRaw(String propertyExpression, Object... vals)
Set using a property expression that can contain?
bind value placeholders.int
update()
Execute the update returning the number of rows updated.ExpressionList<T>
where()
Return the query expression list to add predicates to.
-
-
-
Constructor Detail
-
DefaultUpdateQuery
public DefaultUpdateQuery(DefaultOrmQuery<T> query)
-
-
Method Detail
-
set
public UpdateQuery<T> set(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 interfaceUpdateQuery<T>
- Parameters:
property
- The bean property to be setvalue
- The value to set the property to
-
setNull
public UpdateQuery<T> setNull(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 interfaceUpdateQuery<T>
- Parameters:
property
- The property to be set to null.
-
setRaw
public UpdateQuery<T> setRaw(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 interfaceUpdateQuery<T>
- Parameters:
propertyExpression
- A property expression
-
setRaw
public UpdateQuery<T> setRaw(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 interfaceUpdateQuery<T>
- Parameters:
propertyExpression
- A raw property expressionvals
- The values to bind with the property expression
-
setProfileLocation
public UpdateQuery<T> setProfileLocation(ProfileLocation profileLocation)
Description copied from interface:UpdateQuery
Set the profile location of this update query. This is used to relate query execution metrics back to a location like a specific line of code.- Specified by:
setProfileLocation
in interfaceUpdateQuery<T>
-
setLabel
public UpdateQuery<T> setLabel(String label)
Description copied from interface:UpdateQuery
Set the label on the update query.- Specified by:
setLabel
in interfaceUpdateQuery<T>
-
where
public ExpressionList<T> where()
Description copied from interface:UpdateQuery
Return the query expression list to add predicates to.- Specified by:
where
in interfaceUpdateQuery<T>
-
update
public int update()
Description copied from interface:UpdateQuery
Execute the update returning the number of rows updated.- Specified by:
update
in interfaceUpdateQuery<T>
-
-