Logo of Bento frameworkspaceObject Oriented Programming


JBuilder 2007

Simple DAO Helper

Free source code example for Bento framework...

Seeing is believing! First of all, please enjoy the example of Bento framework that is running on our web site. It is the simple photo Blog where you can upload the image files by your web browser (multipart/form-data), or e-mail with file attachment. After you grasp how it works, please explore its source code. The source code of the example is included in the FREE trial version of Bento framework.

[ Try and download example ... ]

Introduction ...

Simple DAO Helper is the Java API for making DAO (Data Access Object) simpler. The main interface of this Java API is SimpleDaoHelper. Given the QueryData object, the implementation of SimpleDaoHelper is responsible for the next jobs:

On the QueryData object, you can specify:

The following 3 implementations are included in this API:

DaoHelperForJndi:Creates PreparedStatement by JNDI DataSource
DaoHelperForJdbc:Creates PreparedStatement by JDBC Connection
DaoHelperForPooledStatement:Creates PreparedStatement by OOP PooledStatement

These classes implements the next 2 methods:

The first one is for SELECT, and the second is for INSERT, UPDATE or DELETE. Let's follow some very simple scenario. Please look into the very simple SQL table below:

Column NameSQL TypeJava Type
idDECIMAL(3,0)int
nameVARCHAR(255)String
ageDECIMAL(3,0)int

Assume that we will insert the next record into the above table:

Please click the link below and look into the source code:

[ Source code example ... ]

In case of SELECT, the array of return types must also be specified. Please click the link below and see the source code to select the records for the persons older than 20:

[ Source code example ... ]

In the above examples, the fully qualified class name of SimpleDaoHelper interface and the SQL statements are hard-coded within the source code. But, in the production code, all these Strings should be defined in some external resource, such as the deployment descriptor or property resource file.

Read Java doc / FREE Download

You can read the Java doc for this API online. Or it is included in the distribution of this API and you can download it at FREE.

Java doc README
Product License
Download

Copyright © 1997-2008 OOP-Research CorporationTM, All Rights Reserved.

Valid XHTML 1.0! Valid CSS!