> List of tutorials

Index for Base knowledge for developing Fat-Clients with Java

Using Data-Base-Access (DBA) Objects for low level access to database-tables –
Java Base Knowledge.

* For this document and all references (links) please obey the hints and regulations concerning copyright, disclaimer and trademarks.

  • The owner of this web-site (www.javascout.biz) is not responsible for the content of web-sites linked within this document or linked within other documents of www.javascout.biz.

  • If this document or other documents of this web-site (www.javascout.biz) infringes your rights or yout think that rights of others (third parties) are infringed, please inform the author about the incriminated part
    An e-mail can be sent by clicking onto the 'hungry mailbox' in the upper right corner.

Last revision of this document:
2006-07-25

This document deals with Data-Base-Access (DBA) Objects.
DBA Objects contain the code to perform a low level access to database-tables.

The idea is:
one class for each database-table where the table-name and the attribute-names are defined as constants.
This minimizes the possibility to get runtime-errors due to typing errors at attribute-names.

Why design a separate object for Data-Base-Access (and not integrate the DBA into Business Objects) :

The classes for Business-Objects contain enough sophisticated code to handle the business case – to add code for database access would make it more complex :

Business-Objects reflect more complex data-structures and do not relate 1:1 to a database-table:

top.

What makes up a Data-Base-Access (DBA) Object:

A Base Class for defining and handling the Common Attributes

For a discussion, why Common Attributes are introduced, please refer to the document Common Attributes for all database-tables.

Before reading ahead, I recommend to browse through the code of the Base Class JSBS_DBA.
It contains

A Class taylored for the database-table with methods for DELETE. INSERT, UPDATE and SELECT where (by definition) only one database-record can be found.

If you want to see the code of a DBA class (with not too many variables) please follow this link.

The class inherits the base class (JSBS_DBA) and adds the following:

A Class taylored for the database-table with SELECT-operations that may deliver more than one database-record as result

If you want to see the code of a DBA class (with not to many variables) where the selection may deliver more than one database-record, please follow this link.

The class consists mainly of:

top.

To-Do-List for coding a Data-Base-Access Object (and the object with the 'Vector'):

It is a relatively long way from having the GUI (Graphic User Interface) designed to store the entered data in the database, retrieve it (according to some selection criteria) and finally make the values visible on the GUI again.
Depending on the number of attributes in the table the turn-around may take 10 hours and more without getting a visible feedback if the code is implemented error-free.
In my experience, the following sequence (including the coding of the Business Object that needs the Data-Base-Access) has proven as best to get a feedback about the correct operation of the code as soon as possible.

Implement the Business Object (General Class) and start with the Business Object (Client-Side Class)

The To-Do List to code the mentioned Classes for the Business Object is out of the scope of this document.
Please refer to the following links if you are just browsing to this document.
If you are following a To-Do-List to write an application, you should have gone already through these documents. ;-).
Business Object, General Class | To-Do-List
Business Object, Client-Side-Class | To-Do-List

Implement this DBA Class so far that the Business Object (Server-Side Class) can call the minimum set of methods.

Steps to code the class:

The implementation steps (for this class) are complete to allow the implementation of the Server-Side class of the Business Object.
Depending on the requirement of the Business Object using the DBA object, there might arise a demand for more complex methods to be implemented.

top.

Related Documents:

Detailed descriptions concerning Business Objects can be found in the following documents: