View Javadoc
1 /*** $Id: HibernateDAOAction.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 // Java 11 import java.util.List; 12 13 /*** 14 * Base interface of real actions. 15 * <br> 16 * Based on an example of book <i>Code Notes for J2EE, Edited by GREGORY BRILL, 17 * e-ISBN 0-679-64727-9</i> 18 * <br> 19 * Last modified $Date: 2004/05/18 10:50:13 $ 20 * @version $Revision: 1.1.1.1 $ 21 * @author mochoa (mochoa@users.sourceforge.net)*/ 22 public interface HibernateDAOAction extends DAOAction { 23 public static final int SQL_QUERY = 0; 24 public static final int HQL_QUERY = 1; 25 public static final int SAVE = 2; 26 public static final int UPDATE = 3; 27 public static final int DELETE = 4; 28 public static final int LOAD = 5; 29 30 31 /*** This method define an SQL statement to be executed. 32 * @return SQL Statement 33 */ 34 public String getSQL(); 35 36 /*** This method define an HQL statement to be executed. 37 * @return HQL Statement 38 */ 39 public String getHQL(); 40 41 /*** This method retuns the parameters to be setted to SQL/HQL 42 * statement. 43 * @return an array of Objects with the sql/hql statement parameters values. 44 */ 45 public Object[] getParameters(); 46 47 /*** This method retuns the names for parameters to be setted to sql/hql 48 * statement. 49 * If this statement has not parameters, null can be returned. 50 * @return an array of String with the sql/hqp statement parameters names. 51 */ 52 public String[] getNamesForParams(); 53 54 /*** This method is called when this action is of type 55 * <i>SQL_QUERY</i>. Retuns the class name 56 * of the table.<br> 57 * <code></code> 58 * @return an array of Class sql statement out parameters types. 59 */ 60 public Class[] getReturnClassForSqlQuery(); 61 62 /*** This method is called when this action is of type 63 * <i>SQL_QUERY</i>. Retuns the alias name of the 64 * table query.<br> 65 * <code></code> 66 * @return an array of Class sql statement out parameters types. 67 */ 68 public String[] getReturnAliasForSqlQuery(); 69 70 /*** Handle the results of query statements.<br> 71 * If the statement is of type <i>SQL_QUERY,HQL_QUERY</i> (select), then when the 72 * execution of the statement finalize and no exception occurs, this 73 * method is call for handle the results. 74 * @param rs ResultSet returned by query. 75 */ 76 public void handleResults(List rs) throws Exception; 77 78 /*** Handle the results of update statements.<br> 79 * If the statement is of type <i>SAVE/UPDATE/DELETE</i> (insert, update or delete), 80 * then when the execution of the statement finalize and no exception 81 * occurs, this method is call for handle the results. 82 */ 83 public void handleResult() throws Exception; 84 85 /*** Handle the results of load statements.<br> 86 * If the statement is of type <i>LOAD</i> (load), 87 * then when the execution of the statement finalize and no exception 88 * occurs, this method is call for handle the results. 89 * @param to the trasnfer object loaded. 90 */ 91 public void handleResult(Object to) throws Exception; 92 93 /*** Return of statemnt's type. 94 * @return one of this (SQL_QUERY,HQL_QUERY,SAVE,UPDATE,DELETE). 95 */ 96 public int getStmtType(); 97 98 99 /*** Set of statemnt's type. 100 * @param stmtType one of this (SQL_QUERY,HQL_QUERY,SAVE,UPDATE,DELETE). 101 */ 102 public void setStmtType(int stmtType); 103 104 /*** Returs true if this action is a SQL_QUERY statement 105 */ 106 public boolean isSqlQuery(); 107 108 /*** Returs true if this action is a HQL_QUERY statement 109 */ 110 public boolean isHqlQuery(); 111 112 /*** Returs true if this action is an SAVE statement 113 */ 114 public boolean isSave(); 115 116 /*** Returs true if this action is an UPDATE statement 117 */ 118 public boolean isUpdate(); 119 120 /*** Returs true if this action is an DELETE statement 121 */ 122 public boolean isDelete(); 123 124 /*** Returs true if this action is an LOAD statement 125 */ 126 public boolean isLoad(); 127 128 public boolean isCaching(); 129 public void setCaching(boolean caching); 130 }

This page was automatically generated by Maven