JBoss API: Class JDBCUpdateCommand

org.jboss.ejb.plugins.jaws.jdbc
Class JDBCUpdateCommand

java.lang.Object
  |
  +--org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand
        |
        +--org.jboss.ejb.plugins.jaws.jdbc.JDBCUpdateCommand
Direct Known Subclasses:
JDBCCreateEntityCommand, JDBCDestroyCommand, JDBCInitCommand, JDBCRemoveEntityCommand, JDBCStoreEntityCommand

public abstract class JDBCUpdateCommand
extends JDBCCommand

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

Version:
$Revision: 1.4 $
Author:
Justin Forder

Fields inherited from class org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand
debug, factory, jawsEntity, log, name
 
Constructor Summary
protected JDBCUpdateCommand(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 integer result.
protected abstract  java.lang.Object handleResult(int rowsAffected, java.lang.Object argOrArgs)
          Handle the result of successful execution of the update.
 
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

JDBCUpdateCommand

protected JDBCUpdateCommand(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 integer result.
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:
the result from handleResult.
Throws:
java.lang.Exception - if execution or result handling fails.

handleResult

protected abstract java.lang.Object handleResult(int rowsAffected,
                                                 java.lang.Object argOrArgs)
                                          throws java.lang.Exception
Handle the result of successful execution of the update.
Parameters:
rs - the result set from the query.
argOrArgs - argument or array of arguments passed in from subclass execute method.
Returns:
any result needed by the subclass execute.
Throws:
java.lang.Exception - if result handling fails.


Copyright © 2000 The JBoss Organization. All Rights Reserved.