@Update
Marks an interface method to execute an UPDATE statement.
info
value supports string arrays. Elements are joined with spaces, convenient for multi-line writing.
Example: update name by id
@SimpleMapper
public interface UserMapper {
@Update({"update users",
"set name = #{newName}",
"where id = #{userId}"})
int updateUserName(
@Param("userId") int userId,
@Param("newName") String newName
);
}
Properties
| Property | Description |
|---|---|
| value | Required The UPDATE statement to be executed. |
| statementType | Optional JDBC execution mode. Default Prepared- Statement → java.sql.Statement- Prepared → java.sql.PreparedStatement- Callable → java.sql.CallableStatement |
| timeout | Optional Execution timeout in seconds. Default -1 |