|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jenkov.mrpersister.impl.JdbcDao
public class JdbcDao
Field Summary | |
---|---|
protected IDaos |
daos
|
Constructor Summary | |
---|---|
JdbcDao(IDaos daos)
|
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 manager)
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()). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected IDaos daos
Constructor Detail |
---|
public JdbcDao(IDaos daos)
Method Detail |
---|
public java.lang.Long readLong(java.lang.String sql) throws PersistenceException
IJdbcDao
readLong
in interface IJdbcDao
sql
- The SQL that locates the record and column containing the long to read.
PersistenceException
- If something goes wrong during the read.public java.lang.Long readLong(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
IJdbcDao
readLong
in interface IJdbcDao
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.public java.lang.String readIdString(java.lang.String sql) throws PersistenceException
IJdbcDao
readIdString
in interface IJdbcDao
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.public java.lang.String readIdString(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
IJdbcDao
readIdString
in interface IJdbcDao
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.public java.lang.String readIdString(java.lang.String sql, IPreparedStatementManager manager) throws PersistenceException
IJdbcDao
readIdString
in interface IJdbcDao
sql
- The SQL query that locates the ids to add to the id string.
For example: select book_id from books where author_id = ?manager
- 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.public java.lang.Object read(java.lang.String sql, IResultSetProcessor processor) throws PersistenceException
IJdbcDao
read
in interface IJdbcDao
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.public java.lang.Object read(java.lang.String sql, java.lang.Object[] parameters, IResultSetProcessor processor) throws PersistenceException
IJdbcDao
read
in interface IJdbcDao
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.public java.lang.Object read(java.lang.String sql, IPreparedStatementManager statementManager, IResultSetProcessor processor) throws PersistenceException
IJdbcDao
read
in interface IJdbcDao
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.public int update(java.lang.String sql) throws PersistenceException
IJdbcDao
update
in interface IJdbcDao
sql
- The SQL containing the update.
PersistenceException
- If anyting goes wrong during the update.public int update(java.lang.String sql, java.lang.Object[] parameters) throws PersistenceException
IJdbcDao
update
in interface IJdbcDao
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.public int update(java.lang.String sql, IPreparedStatementManager statementManager) throws PersistenceException
IJdbcDao
update
in interface IJdbcDao
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 |