Caché object technologies give application developers the means to easily create high performance, object-based, database applications.
The features of Caché objects include:
A powerful object model that includes inheritance, properties, methods, collections, relationships, user-defined data types, and streams.
A flexible object persistence mechanism that allows objects to be stored within the native Caché database as well as external relational databases.
Control over the database aspects of persistent classes including indices, constraints, and referential integrity.
An easy-to-use transaction and concurrency model that includes the ability to load objects by navigationsimply referring to an object can swizzle
it into memory from the database.
Automatic integration with Caché SQL via the Caché unified data architecture.
Interoperability with Java, C++, and ActiveX.
A powerful, multi-user object development environment: Studio.
You can use Caché objects in many ways including:
To define the database and/or business components of a transaction processing application.
To create a web-based user interface using Caché Server Pages.
To define object-based stored procedures that are callable from ODBC or JDBC.
To provide object/relational access to legacy applications.
Caché Objects Architecture
Caché object technology contains the following major components:
The class dictionary
A repository of class definitions (often known as metadata), each of which describes a specific class. This repository is stored within a Caché database. The class dictionary is also used by the Caché SQL engine and is responsible for maintaining synchronized object and relational access to Caché data.
The class compiler
A set of programs that convert class definitions into executable code.
The object runtime system
A set of features built into the Caché virtual machine that support object operations (such as object instantiation, method invocation, and polymorphism) within a running program.
The Caché class library
A set of prebuilt classes that come with every Caché installation. This includes classes that are used to provide behaviors for user-defined classes (such as persistence or data types) as well as classes that are intended for direct use within applications (such as email classes).
Class Definitions and the Class Dictionary
Every class has a definition
that specifies what members (properties, methods, and so on) it contains as well as class-wide characteristics (such as superclasses). These definitions are contained within the class dictionary, which is itself stored within the Caché database.
Creating Class Definitions
You can create class definitions in many ways:
. The primary means of working with Caché class definitions is with the Studio Development Environment.
Using XML. Class definitions have an external, XML-based representation. Typically this format is used for storing class definitions externally (such as in source control systems), deploying applications, or simply for sharing code. You can also create new class definitions programmatically by simply generating the appropriate XML class definition file and loading it into a Caché system.
Using an API. Caché includes a set of class definition classes that provide object access to the class dictionary. You can use these to observe, modify, and create class definitions.
Using SQL DDL
. Any relational tables defined by DDL statements are automatically converted to equivalent class definitions and placed within the class dictionary.
Every Caché namespace is automatically configured so that its class dictionary, in addition to containing its own classes, has access to the system class definitions and code within the CACHELIB database. By this mechanism, all namespaces can make direct use of the classes in the Caché class library.
The class dictionary contains two distinct types of data:
Definition data The actual class definitions that users create.
Compilation data Data generated as a result of compiling class definitions is also stored. This data includes the results of inheritance resolution; that is, it lists all the defined and inherited members for a given class. The class compiler uses this to make other compilation more efficient; applications can also use it (via the appropriate interface) to get runtime information about class members.
The class dictionary stores its data in a set of globals (persistent arrays) whose names start with ^odd
. The structure of these arrays may change with new versions of Caché, so applications should never directly observe or modify these structures.
The Caché class library contains a set of prebuilt classes. It is automatically installed with every Caché system within the CACHELIB database. You can view the contents of the Caché class library using the online class documentation system provided with Caché.
The Caché class library contains a number of packages, each of which contains a family of classes. Some of these are internal and Caché objects uses them as part of its implementation. Other classes provide features that are designed for use in applications.
The main packages within the Caché class library include:
Caché Class Library Packages
Caché includes a number of tools for developing object-based applications. In addition, it is quite easy to use Caché with other development environments.
Studio is an integrated, visual development environment for creating Caché class definitions. See Using Studio
for more details.
It is possible to develop Caché applications using SQL-based tools, since Caché automatically creates a class definition from any relational tables defined using SQL DDL statements. This approach does not exploit the full power of objects because you are limited by what DDL can express; however, it is useful for migrating legacy applications.
It is possible to develop class definitions as XML documents and load them into Caché. You can do this using either the Caché-specific XML format for class definitions or you can use an XML schema
User Interface Development and Client Connectivity