## org.jboss.ejb.plugins.jaws.jdbc
Class JDBCQueryCommand

    java.lang.Object
      |
      +--org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand
            |
            +--org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand

Direct Known Subclasses:
  JDBCBeanExistsCommand, JDBCFinderCommand, JDBCLoadEntityCommand

public abstract class JDBCQueryCommand
extends JDBCCommand

Abstract superclass for all JAWS Commands that issue JDBC queries directly. Provides a Template Method implementation for `executeStatementAndHandleResult`.

Version:
  $Revision: 1.5.6.1 $
Author:
  Justin Forder

Fields inherited from class org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand
`debug, factory, jawsEntity, log, name`

Constructor Summary
`protected` `JDBCQueryCommand(JDBCCommandFactory factory, java.lang.String name)` Pass the arguments on to the superclass constructor.

Method Summary
`protected java.lang.Object` `executeStatementAndHandleResult(java.sql.PreparedStatement stmt, java.lang.Object argOrArgs)` Template Method that executes the PreparedStatement and calls `handleResult` on the resulting ResultSet.
`protected abstract java.lang.Object` `handleResult(java.sql.ResultSet rs, java.lang.Object argOrArgs)` Handles the result of successful execution of the query.

Methods inherited from class org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand
`getCMPFieldValue, getConnection, getJawsCMPFieldJDBCType, getJDBCType, getJDBCTypeName, getPkColumnList, getPkColumnWhereList, getPkFieldValue, getResultObject, getResultObject, getSQL, getState, isBinaryType, jdbcExecute, setCMPFieldValue, setParameter, setParameters, setPrimaryKeyParameters, setSQL`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JDBCQueryCommand

    protected JDBCQueryCommand(JDBCCommandFactory factory,
                               java.lang.String name)

  Pass the arguments on to the superclass constructor.

Method Detail

### executeStatementAndHandleResult

    protected java.lang.Object executeStatementAndHandleResult(java.sql.PreparedStatement stmt,
                                                               java.lang.Object argOrArgs)
                                                        throws java.lang.Exception

  Template Method that executes the PreparedStatement and calls `handleResult` on the resulting ResultSet.
  Overrides:
    `executeStatementAndHandleResult` in class `JDBCCommand`
  Parameters:
    `stmt` - the prepared statement, with its parameters already set.
    `argOrArgs` - argument or array of arguments passed in from subclass execute method.
  Returns:
    any result produced by the handling of the result of executing the prepared statement.
  Throws:
    `java.lang.Exception` - if execution or result handling fails.

### handleResult

    protected abstract java.lang.Object handleResult(java.sql.ResultSet rs,
                                                     java.lang.Object argOrArgs)
                                              throws java.lang.Exception

  Handles the result of successful execution of the query.
  Parameters:
    `rs` - the result set from the query.
    `argOrArgs` - argument or array of arguments passed in from subclass execute method.
  Returns:
    any result produced by the handling of the result of executing the prepared statement.
  Throws:
    `java.lang.Exception` - if execution or result handling fails.

Copyright © 2000 The JBoss Organization. All Rights Reserved.