|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.interface21.jdbc.object.RdbmsOperation
|
+--com.interface21.jdbc.object.SqlOperation
|
+--com.interface21.jdbc.object.SqlQuery
Reusable threadsafe object to represent a SQL query.
Subclasses must implement the newResultReader() method to
provide an object that can save the results of iterating
over the ResultSet.
This class provides a number of public final execute() methods that are
analogous to the different convenient JDO query execute() methods. Subclasses
can either rely on one of these inherited methods, or can add their own
custom execution methods, with meaningful names and typed parameters. Each
custom query method will invoke one of this class's untype query methods.
| Fields inherited from class com.interface21.jdbc.object.RdbmsOperation |
logger |
| Constructor Summary | |
SqlQuery()
Allow use as a bean |
|
SqlQuery(javax.sql.DataSource ds,
java.lang.String sql)
Convenient constructor. |
|
| Method Summary | |
java.util.List |
execute()
Convenient method to execute without parameters |
java.util.List |
execute(int p1)
Convenient method to execute with a single int parameter |
java.util.List |
execute(int p1,
int p2)
Convenient method to execute with two int parameters |
java.util.List |
execute(java.lang.Object[] parameters)
All execution goes through this method |
java.util.List |
execute(java.lang.String p1)
Convenient method to execute with a single String parameter |
java.lang.Object |
findObject(int p1)
Convenience method to find a single object given a single int parameter |
java.lang.Object |
findObject(int p1,
int p2)
Convenience method to find a single object given two int parameters |
java.lang.Object |
findObject(java.lang.Object[] parameters)
Generic findObject method, used by all other findObject() methods. findObject() methods are like EJB entity bean finders, in that it is considered an error if they return more than one result. |
java.lang.Object |
findObject(java.lang.String p1)
Convenience method to find a single object given a single String parameter |
int |
getRowsExpected()
Gets the number of rows expected. |
protected abstract ResultReader |
newResultReader(int rowsExpected,
java.lang.Object[] parameters)
Subclasses must implement this method to save a List of objects returned by the execute() method. |
protected void |
onCompileInternal()
Subclasses can override this method to implement custom behavior on compilation. |
void |
setRowsExpected(int rowsExpected)
Sets the number of rows expected. |
| Methods inherited from class com.interface21.jdbc.object.SqlOperation |
compileInternal, getJdbcTemplate, newPreparedStatementCreator |
| Methods inherited from class com.interface21.jdbc.object.RdbmsOperation |
afterPropertiesSet, compile, declareParameter, getDataSource, getDeclaredParameters, getSql, isCompiled, setDataSource, setSql, setTypes, validateParameters |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SqlQuery()
public SqlQuery(javax.sql.DataSource ds,
java.lang.String sql)
ds - DataSource to use to get connectionsSQL - to execute. SQL can also be supplied at runtime by overriding
the getSql() method.| Method Detail |
public int getRowsExpected()
public void setRowsExpected(int rowsExpected)
rowsExpected - The rowsExpected to set
protected abstract ResultReader newResultReader(int rowsExpected,
java.lang.Object[] parameters)
rowsExpected. - If 0, we don't know how many rows to expect.
This parameter can be ignored, but may help some implementations
choose the most efficient Collection type: e.g. ArrayList
instead of LinkedList for large result sets.parameters - parameters to the execute() method, in case subclass is interested.
May be null if there were no parameters.
public final java.util.List execute(java.lang.Object[] parameters)
throws DataAccessException
parameters - parameters, as to JDO queries. Primitive parameters must
be represented by their Object wrapper type. The ordering of parameters is
significant.
public final java.util.List execute()
throws DataAccessException
public final java.util.List execute(int p1)
throws DataAccessException
p1 - single int parameter
public final java.util.List execute(int p1,
int p2)
throws DataAccessException
public final java.util.List execute(java.lang.String p1)
throws DataAccessException
public final java.lang.Object findObject(java.lang.Object[] parameters)
throws DataAccessException
public final java.lang.Object findObject(int p1)
throws DataAccessException
public final java.lang.Object findObject(int p1,
int p2)
throws DataAccessException
public final java.lang.Object findObject(java.lang.String p1)
throws DataAccessException
protected void onCompileInternal()
onCompileInternal in class SqlOperation
|
[Deprecated API] | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | CURRENT API | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||