Class DeleteCommand

java.lang.Object
org.seasar.doma.jdbc.command.ModifyCommand<DeleteQuery>
org.seasar.doma.jdbc.command.DeleteCommand
All Implemented Interfaces:
Command<Integer>

public class DeleteCommand extends ModifyCommand<DeleteQuery>
A command that executes DELETE SQL statements.

This class extends ModifyCommand to provide specific functionality for executing DELETE operations in a database. It handles the execution of prepared statements for deleting data and tracks execution statistics.

The command returns the number of rows affected by the DELETE operation.

  • Constructor Details

    • DeleteCommand

      public DeleteCommand(DeleteQuery query)
      Constructs a new DeleteCommand with the specified query.
      Parameters:
      query - the delete query to execute, which contains the SQL statement and configuration
  • Method Details

    • executeInternal

      protected int executeInternal(PreparedStatement preparedStatement) throws SQLException
      Executes the DELETE statement and returns the number of affected rows.

      This method uses the statistic manager to track execution statistics for the SQL operation if statistics collection is enabled.

      Specified by:
      executeInternal in class ModifyCommand<DeleteQuery>
      Parameters:
      preparedStatement - the prepared statement to execute
      Returns:
      the number of rows affected by the DELETE operation
      Throws:
      SQLException - if a database access error occurs during execution