commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Juozas Baliuka" <bali...@mail.lt>
Subject [dbutils] Current Status
Date Tue, 11 Mar 2003 19:26:04 GMT

It is report about code I added last week and status:

1.Handler interface is changed and moved to the main package.
2.Added dependancy on QDox.
3. Added ProcedureUtils.

ProcedureUtils is utils is factory for DAO.
DAO are declared as interfaces with metadata (custom javadoc tags).
Implementation for DAO is generated at runtime, source code file is used as
resource for metadata at runtime.
Callbacks are invoked to handle result sets (ResultSetHandler interface
implementation). Predefined hanlers used for the most common and trivial
situations.
Parametrezed and dynamic SQL is supported.

example:
public interface DAO{

    /**
     *@query SELECT  COUNT(1) > 0 FROM {0} WHERE ID=$1
     */
    public boolean exists( String tableName, int id );

}

{0} - dynamic SQL parameter
 $1  - parametrezed SQL parameter

Usage:

//generates implementation from class object and source file
 DAO dao = ( DAO)ProcedureUtils.getInstance( DAO.class, connection);

//executes query: "SELECT  COUNT(1) > 0 FROM TABLE_NAME WHERE ID=?"

 if( dao.exists( "TABLE_NAME" , 0 ) ){
  //.............
}






---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message