|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IJdbcDao
Represents a DAO capable of simplifying the most ordinary JDBC tasks like reading a long from the database, iterating a ResultSet and executing an update.
Method Summary | |
---|---|
java.lang.Object |
read(java.lang.String sql,
IPreparedStatementManager statementManager,
IResultSetProcessor processor)
Executes the given SQL and calls the IResultSetProcessor's process(...) method for each record in the ResultSet. |
java.lang.Object |
read(java.lang.String sql,
IResultSetProcessor processor)
Executes the given SQL and calls the IResultSetProcessor's process(...) method for each record in the ResultSet. |
java.lang.Object |
read(java.lang.String sql,
java.lang.Object[] parameters,
IResultSetProcessor processor)
Executes the given SQL and calls the IResultSetProcessor's process(...) method for each record in the ResultSet. |
java.lang.String |
readIdString(java.lang.String sql)
Reads all the ids located by the given SQL into an id string that can be used in an SQL select ... |
java.lang.String |
readIdString(java.lang.String sql,
IPreparedStatementManager statementManager)
Reads all the ids located by the given SQL into an id string that can be used in an SQL select ... |
java.lang.String |
readIdString(java.lang.String sql,
java.lang.Object[] parameters)
Reads all the ids located by the given SQL into an id string that can be used in an SQL select ... |
java.lang.Long |
readLong(java.lang.String sql)
Reads a long from the database using the given SQL query. |
java.lang.Long |
readLong(java.lang.String sql,
java.lang.Object[] parameters)
Reads a long from the database using the given SQL query. |
int |
update(java.lang.String sql)
Executes the given SQL as an update (PreparedStatement.executeUpdate()). |
int |
update(java.lang.String sql,
IPreparedStatementManager statementManager)
Executes the given SQL as an update (PreparedStatement.executeUpdate()). |
int |
update(java.lang.String sql,
java.lang.Object[] parameters)
Executes the given SQL as an update (PreparedStatement.executeUpdate()). |
Method Detail |
---|
java.lang.Long readLong(java.lang.String sql) throws PersistenceException
sql
- The SQL that locates the record and column containing the long to read.
PersistenceException
- If something goes wrong during the read.java.lang.Long readLong(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
sql
- The SQL that locates the record and column containing the long to read.
Formatted as an SQL query for a PreparedStatement, with ?-marks for parameters to insert.parameters
- The parameters to insert into the PreparedStatement before
executing the SQL. For instance new Object[]{45}
PersistenceException
- If something goes wrong during the read.java.lang.String readIdString(java.lang.String sql) throws PersistenceException
sql
- The SQL query that locates the ids to add to the id string.
For example: select book_id from books where author_id = 2
PersistenceException
- If anything goes wrong during the read.java.lang.String readIdString(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
sql
- The SQL query that locates the ids to add to the id string.
For example: select book_id from books where author_id = ?parameters
- The parameters to insert into the PreparedStatement before
executing the SQL. For instance new Object[]{45}
PersistenceException
- If anything goes wrong during the read.java.lang.String readIdString(java.lang.String sql, IPreparedStatementManager statementManager) throws PersistenceException
sql
- The SQL query that locates the ids to add to the id string.
For example: select book_id from books where author_id = ?statementManager
- An instance capable of preparing, initializing
parameters of, and post-processing the PreparedStatement
being used to execute the SQL. It is easiest to extend
the PreparedStatementManagerBase which has default implementations
for the prepare(...), init(...), execute(...) and postProcess() methods.
PersistenceException
- If anything goes wrong during the read.java.lang.Object read(java.lang.String sql, IResultSetProcessor processor) throws PersistenceException
sql
- The SQL that locates the records to iterate.processor
- The IResultSetProcessor implementation that processes the ResultSet.
It is easiest to extend the ResultSetProcessorBase which has empty
implementations for init(...), process(...), and getResult(). Then
you only have to override the methods you need.
PersistenceException
- If anything goes wrong during the execution of the SQL and the
iteration of the ResultSet.java.lang.Object read(java.lang.String sql, java.lang.Object[] parameters, IResultSetProcessor processor) throws PersistenceException
sql
- The SQL that locates the records to iterate.parameters
- The parameters to insert into the PreparedStatement before executing the SQL.processor
- The IResultSetProcessor implementation that processes the ResultSet.
It is easiest to extend the ResultSetProcessorBase which has empty
implementations for init(...), process(...), and getResult(). Then
you only have to override the methods you need.
PersistenceException
- If anything goes wrong during the execution of the SQL and the
iteration of the ResultSet.java.lang.Object read(java.lang.String sql, IPreparedStatementManager statementManager, IResultSetProcessor processor) throws PersistenceException
sql
- The SQL that locates the records to iterate.statementManager
- An instance capable of preparing, initializing
parameters of, and post-processing the PreparedStatement
being used to execute the SQL. It is easiest to extend
the PreparedStatementManagerBase which has default implementations
for the prepare(...), init(...), execute(...) and postProcess() methods.processor
- The IResultSetProcessor implementation that processes the ResultSet.
It is easiest to extend the ResultSetProcessorBase which has empty
implementations for init(...), process(...), and getResult(). Then
you only have to override the methods you need.
PersistenceException
- If anything goes wrong during the execution of the SQL and the
iteration of the ResultSet.int update(java.lang.String sql) throws PersistenceException
sql
- The SQL containing the update.
PersistenceException
- If anyting goes wrong during the update.int update(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
sql
- The SQL containing the update.parameters
- The parameters to insert into the PreparedStatement before executing the SQL.
PersistenceException
- If anyting goes wrong during the update.int update(java.lang.String sql, IPreparedStatementManager statementManager) throws PersistenceException
sql
- The SQL containing the update.statementManager
- An instance capable of preparing, initializing
parameters of, and post-processing the PreparedStatement
being used to execute the SQL. It is easiest to extend
the PreparedStatementManagerBase which has default implementations
for the prepare(...), init(...), execute(...) and postProcess() methods.
PersistenceException
- If anyting goes wrong during the update.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |