Saturday, 19 March 2011

Simple DAO Tutorial - 5

This DAO is a new version of the original one that
you can find at:

I have used this original DAO's MySQL implementation files
in the Simple CRUD with JQuery and many other examples at my blog.

The problem in the original DAO was it reorganised the DB as soon as
a record was deleted. This was caused by a wrong design
decision that each record should have a sequential id with no
ids missing in between them.

I removed this requirement in this new version of DAO with:

public Person readNextRec() throws PersonDAOSysException {
stmt = conn.prepareStatement("select id, firstName, lastName, "
+ " hobby from personTab where id > ? ORDER BY ID ASC LIMIT 1");
This is true for only HSQL and MySQL DBs. The vector 'DB' is left as
it was.

To read an in depth analysis of this package please refer to

To correct speed problems at the delete function of Simple CRUD with JQuery
you may use of nbDAObasicARSv1.0.

I will provide a new version as such for Simple CRUD with JQuery
in the near future. Also a new master - detail on the same JSP
will follow.

Once again this for only training purposes, it is not meant for
any other.

You can download the source files from sourceforge: