| Tutorial: (Objects) Simple Accounting System; Version 0.0.1; Document Revision $Revision: 1.17 $ | ||
|---|---|---|
| Prev | Next | |
This directory contains a small technology domonstration for the following technical issues:
Representing data objects using Ada 95
Usage of an SQL based RDBMS to achieve persistency for Ada 95 instances.
Relations between objects
The data model used for the demonstration is quite simple. Each person identified by its name. Assigned to each person there are upto N accounts assgined. Each account includes a balance. Each person may be included into multiple groups, e.g. family group. A group again may be associated with accounts.

Datamodel of the demonstration
This demonstration addresses large information systems which are running algorithms on large databases on a datamodel similar to the one presented here. For such kind of systems the following issues have to be understood:
How to store and retrieve the mass data.
How to share the data between different clients.
How to represent the data in a form which most suitable for the implementation language.
The expectation for data storage/retrieval system is that the data is always available for read/update/write. From a high level view there are instances to be stored and each instance has attributes, decribing the visible contents of an instance.
Retrival is done by queries which are based on the values of the attrbiutes and which may return sets of instances.
In the example presented here there are three clients which are intended to represent the typical access patterns to the underlying database.
A process which inserts large numbers of instances.
A customer care client which is used to interrogate and modify the data base for a small number of subscribers.
A billing run, which runs periodically to agregate costs and creates a bill for each person.
Each object of the data model is represented by data type which is derived from the type Persistent.Object which implements the basic functionality to serialize/deserialize the data instance into a blob which is stored in a database record. In order to retrieve such an instance a so called object id is used as a retieval key. The key is defined when the objects is instanciated, e.g. in the example below:
Example 1-1. Life cycle of an persistent object
procedure Demo is
...
Father : Person.Object;
begin
Get_Object( Father, ID => 12 );
Father.Age := .... ;
Put_Object( Father );
end Demo;
The example above shows the lifecycle of an persistent object. During declaration of the object the object identifier 1 is assgined to the instance. The method Get_Object is used retrieve the latest version of the object from the data base. Put_Object writes back a new version of the instance Father. Between Get_Object and Put_Object any modification may be done to the object by means of Ada 95 constructs.
The objects package provides an versioning concept, which means after creating the first instance the operation Put_Object may create a new version of the instance in the database.