This document describes the data access layer used in the application Airlog. This layer makes the data access to the database more generic, not just for more entities, but also for more database engines, e.g. the core application does not handle how an entity is created, updated or deleted in the database, and the layer even hides the specific way in different databases.
This class extends java.sql.Connection, but handles reconnection of the connection in case it is lost. Also is refuses to use Statements, it will only allow PreparedStatements. If wanted this would be a logic place to put cache of PrepareStatements.
This class has a java.sql.PreparedStatement (which is given with the constructor). The main goal for this class is, it handles objects, instead of primitives, e.g. set-methods (set(Long l)) has been added.
This class has a java.sql.ResultSet (which is given with the constructor). The main goal for this class is, it handles objects, instead of primitives, e.g. getLong returns Long, not long.
This interface insures DataAccessObject and DataAccessDelegator have the same methods.
This class uses the template pattern, e.g. when calling the create-method it executes some generic code, e.g. generate the SQL, then calls the data access specific doCreate-methods to set the actually data. This class reads the property file for the specific data access, for mapping the given entity names to the field in the database.
The following key can/must be used in the property-file:
This class extends DataAccessObject, and overwrites methods that are DBMS-specific, e.g. how to resolve a sequence number.
This class delegate method calls to the right DataAccessObject instance.
This class handles the generic create, update, delete and findByKey-methods.
To implement a new data access for an entity these step must be taken.