View Javadoc
1 /*** $Id: JdbcDAOAction.java,v 1.1.1.1 2004/05/18 10:50:13 mochoa Exp $ */ 2 package org.j2ee.dao; 3 4 //sql 5 import java.sql.CallableStatement; 6 import java.sql.PreparedStatement; 7 import java.sql.ResultSet; 8 import java.sql.SQLException; 9 10 /*** 11 * Base interface of real actions. 12 * <br> 13 * Based on an example of book <i>Code Notes for J2EE, Edited by GREGORY BRILL, 14 * e-ISBN 0-679-64727-9</i> 15 * <br> 16 * Last modified $Date: 2004/05/18 10:50:13 $ 17 * @version $Revision: 1.1.1.1 $ 18 * @author jvlio (jvlio@users.sourceforge.net)*/ 19 public interface JdbcDAOAction extends DAOAction { 20 public static final int QUERY = 0; 21 public static final int UPDATE = 1; 22 public static final int CALL_PROCEDURE = 2; 23 public static final int CALL_FUNCTION = 3; 24 public static final int DDL = UPDATE; 25 26 public static final int NO_OUT_PARAM = -9999999; 27 28 /*** This method define the sql statement to be executed. 29 * @return SQL Statement 30 */ 31 public String getSQL(); 32 33 /*** This method retuns the parameters to be setted to sql 34 * statement. 35 * @return sql statement parameters values. 36 */ 37 public Object[] getParameters(); 38 39 /*** This method retuns the SQL Type for parameters to be setted to sql 40 * statement. 41 * If this statement has not parameters, null can be returned. 42 * @see java.sql.Types 43 * @return sql statement parameters types. 44 */ 45 public int[] getDataTypesForParams(); 46 47 /*** This method is called when this action is of type 48 * <i>CALL_PROCEDURE</i> or <i>CALL_FUNCTION</i>. Retuns the SQL 49 * Type for out parameters.<br> 50 * The setings of out parametes begin with the first '?' mark and 51 * continue. If the only second '?' is an out parameter, then 52 * you can return an array like this:<br> 53 * <code>return new int[] = {NO_OUT_PARAM, Types.VARCHAR};</code><br> 54 * If this statement has not out parameters, null can be returned. 55 * @see java.sql.Types 56 * @return sql statement out parameters types. 57 */ 58 public int[] getDataTypesForOutParams(); 59 60 /*** Handle the results of query statements.<br> 61 * If the statement is of type <i>QUERY</i> (select), then when the 62 * execution of the statement finalize and no exception occurs, this 63 * method is call for handle the results. 64 * @param rs ResultSet returned by query. 65 */ 66 public void handleResults(ResultSet rs) throws SQLException; 67 68 /*** Handle the results of update statements.<br> 69 * If the statement is of type <i>UPDATE</i> (insert, update or delete), 70 * then when the execution of the statement finalize and no exception 71 * occurs, this method is call for handle the results. 72 * @param rowsAffected Rows affecteds by execution of this action. 73 */ 74 public void handleResults(int rowsAffected) throws SQLException; 75 76 /*** Handle the results of call statements.<br> 77 * If the statement is of type <i>CALL_PROCEDURE</i> or 78 * <i>CALL_FUNCTION</i>, then when the execution of the statement 79 * finalize and no exception occurs, this method is call for handle the 80 * results. 81 * @param cstmt CallableStatement used for execute this call. 82 */ 83 public void handleResults(CallableStatement cstmt) throws SQLException; 84 85 /*** Return of statemnt's type. 86 * @return one of this (QUERY,UPDATE,CALL_PROCEDURE,CALL_FUNCTION). 87 */ 88 public int getStmtType(); 89 90 91 /*** Set of statemnt's type. 92 * @param stmtType one of this (QUERY,UPDATE,CALL_PROCEDURE,CALL_FUNCTION). 93 */ 94 public void setStmtType(int stmtType); 95 96 /*** Returs true if this action is a QUERY statement 97 */ 98 public boolean isQuery(); 99 100 /*** Returs true if this action is an UPDATE statement 101 */ 102 public boolean isUpdate(); 103 104 /*** Returs true if this action is a CALL statement 105 */ 106 public boolean isCall(); 107 108 public boolean isCaching(); 109 public void setCaching(boolean caching); 110 public void cachPreparedStatement(PreparedStatement pstmt); 111 public PreparedStatement getPreparedStatement(); 112 113 }

This page was automatically generated by Maven