Class AbstractQuery

java.lang.Object
org.seasar.doma.jdbc.query.AbstractQuery
All Implemented Interfaces:
Query
Direct Known Subclasses:
AbstractCreateQuery, AbstractSelectQuery, AutoBatchModifyQuery, AutoModifyQuery, AutoModuleQuery, SqlBatchModifyQuery, SqlFileBatchModifyQuery, SqlFileModifyQuery, SqlFileScriptQuery, SqlModifyQuery, SqlProcessorQuery

public abstract class AbstractQuery extends Object implements Query
The base abstract class for all query implementations.

This class provides common functionality for all query types.

  • Field Details

    • callerClassName

      protected String callerClassName
      The class name of the caller.
    • callerMethodName

      protected String callerMethodName
      The method name of the caller.
    • config

      protected Config config
      The configuration.
    • method

      protected Method method
      The method that defines the query.
    • queryTimeout

      protected int queryTimeout
      The query timeout in seconds.
    • message

      protected String message
      The message to be included in SQL comments.
  • Constructor Details

    • AbstractQuery

      protected AbstractQuery()
      Creates a new instance.
  • Method Details

    • getClassName

      public String getClassName()
      Returns the class name where the query is defined.
      Specified by:
      getClassName in interface Query
      Returns:
      the class name
    • setCallerClassName

      public void setCallerClassName(String callerClassName)
      Sets the class name of the caller.
      Parameters:
      callerClassName - the class name
    • getMethodName

      public String getMethodName()
      Returns the method name where the query is defined.
      Specified by:
      getMethodName in interface Query
      Returns:
      the method name
    • setCallerMethodName

      public void setCallerMethodName(String callerMethodName)
      Sets the method name of the caller.
      Parameters:
      callerMethodName - the method name
    • getConfig

      public Config getConfig()
      Returns the configuration for this query.
      Specified by:
      getConfig in interface Query
      Returns:
      the configuration
    • setConfig

      public void setConfig(Config config)
      Sets the configuration.
      Parameters:
      config - the configuration
    • getMethod

      public Method getMethod()
      Returns the method object where the query is defined.
      Specified by:
      getMethod in interface Query
      Returns:
      the method object
    • setMethod

      public void setMethod(Method method)
      Sets the method that defines the query.
      Parameters:
      method - the method
    • getQueryTimeout

      public int getQueryTimeout()
      Returns the query timeout in seconds.
      Specified by:
      getQueryTimeout in interface Query
      Returns:
      the query timeout
    • setQueryTimeout

      public void setQueryTimeout(int queryTimeout)
      Sets the query timeout in seconds.
      Parameters:
      queryTimeout - the query timeout
    • setMessage

      public void setMessage(String message)
      Sets the message to be included in SQL comments.
      Parameters:
      message - the message
    • prepare

      public void prepare()
      Prepares this query for execution. This method must be called before the query is executed.
      Specified by:
      prepare in interface Query
    • comment

      public String comment(String sql)
      Adds a comment to the SQL statement.
      Specified by:
      comment in interface Query
      Parameters:
      sql - the SQL statement
      Returns:
      the SQL statement with the comment