|
OOP SimpleDaoHelper Version 1.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.bentofw.dao.SimpleDaoHelperImpl
public abstract class SimpleDaoHelperImpl
The abstract super class for the implementation of
SimpleDaoHelper interface.
The 3 implementations of SimpleDaoHelper interface
are available in this package. They are:
DaoHelperForJndi: Creates PreparedStatement by JNDI DataSourceDaoHelperForJdbc: Creates PreparedStatement by JDBC ConnectionDaoHelperForPooledStatement: Creates PreparedStatement by OOP PooledStatement
| Constructor Summary | |
|---|---|
SimpleDaoHelperImpl()
|
|
| Method Summary | |
|---|---|
abstract void |
closeResource(java.sql.ResultSet res,
java.sql.PreparedStatement ps,
java.sql.Connection con,
boolean isOK)
Close the specified ResultSet, PreparedStatement and Connection. |
abstract java.sql.Connection |
getConnection()
Return the JDBC Connection. |
abstract java.sql.PreparedStatement |
getPrepareStatement(java.sql.Connection con,
java.lang.String sql)
Return the JDBC PreparedStatement for the given SQL statement. |
java.util.List |
select(QueryData data,
int[] return_types)
Based on the given QueryData object, this method
executes PreparedStatement. |
int |
update(QueryData data)
Based on the given QueryData object, this method
executes PreparedStatement. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleDaoHelperImpl()
| Method Detail |
|---|
public abstract java.sql.Connection getConnection()
throws java.sql.SQLException
DaoHelperForJndi, this method
queries Connection on the JNDI DataSource.
If you use DaoHelperForJdbc, Connection is created
from DriverManager each time this method is called.
Or, when DaoHelperForPooledStatement is used, this
method returns null, because
OOP PooledStatement keeps the Connection in its
pool along with the PreparedStatement.
getConnection in interface SimpleDaoHelperjava.sql.SQLException
public abstract java.sql.PreparedStatement getPrepareStatement(java.sql.Connection con,
java.lang.String sql)
throws java.sql.SQLException
DaoHelperForJndi or
DaoHelperForJdbc, this method creates
PreparedStatement from the specified Connection.
DaoHelperForPooledStatement, this
method picks the PreparedStatement from the pool of
OOP PooledStatement.
Because Connection is always null, please
specify null as the first parameter.
getPrepareStatement in interface SimpleDaoHelpercon - JDBC Connectionsql - SQL statement
java.sql.SQLException
public abstract void closeResource(java.sql.ResultSet res,
java.sql.PreparedStatement ps,
java.sql.Connection con,
boolean isOK)
DaoHelperForJndi or
DaoHelperForJdbc, this method calls
close method on them.
DaoHelperForPooledStatement, this
method closes only ResultSet. And PreparedStatement will
be pushed back to the pool of
OOP PooledStatement.
As for Connection, this method does nothing, because it is
always null.
closeResource in interface SimpleDaoHelperres - ResultSetps - PreparedStatementcon - ConnectionisOK - This parameter will be used only by
DaoHelperForPooledStatement, because the
PreparedStatement should not be pushed back to the pool if
something is wrong.
But, to make your code portable between the implementations,
please specify the correct value.
If SQLException is thrown while playing with
PreparedStatement, please specify false.
Otherwise, true.
public java.util.List select(QueryData data,
int[] return_types)
throws java.sql.SQLException,
SimpleException
QueryData object, this method
executes PreparedStatement.
select in interface SimpleDaoHelperdata - QueryData object.return_types - The int array which consists of the
pre-defined int constants.
java.sql.SQLException
SimpleException
public int update(QueryData data)
throws java.sql.SQLException,
SimpleException
QueryData object, this method
executes PreparedStatement.
update in interface SimpleDaoHelperdata - QueryData object.
java.sql.SQLException
SimpleException
|
OOP SimpleDaoHelper Version 1.2 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ALL CONTENTS COPYRIGHT 2005, OOP-Research Corporation. All rights reserved.
Any questions and comments are welcome to OOP-Research Corporation.