Using Java with Caché Jalapeño
The Jalapeño Persistence Library for Java
The Jalapeño Persistence Library for Java is a powerful, lightweight tool that provides an easy way for your Java application to store and access POJOs (Plain Old Java Objects) without mapping.
Jalapeño was designed from the beginning to avoid these problems. It allows you to store POJOs in a database without object-relational mapping, and yet provides easy access to the stored objects with standard, high-performance SQL. The Jalapeño runtime API provides methods that make data storage and retrieval even easier. The object database schema can also be exported to a corresponding relational schema, allowing Jalapeño applications to store and access objects on relational databases.
Jalapeño offers the following benefits:
POJOs can be turned into persistent objects. Jalapeño takes POJO class definitions, analyzes them using Java introspection, and automatically creates a corresponding object database schema. This schema can make use of object features such as inheritance, collections, relationships, and complex data types. Developers can supply additional database level specifications such as indices, triggers, and constraints by adding standard Java annotations to their Java source files.
Within the database, persistent objects are stored as true objects (not just the serialized state of the object), preserving properties, relationships, and other object-oriented features. Within an application, developers access their POJO classes directly with the Jalapeño runtime API, which provides methods for operations such as establishing a connection to the database, retrieving objects from the database, saving objects to the database, and issuing queries against the database.
The Jalapeño API is implemented as a superset of the JDBC API. All objects within the database are automatically viewable as relational tables using the standard JDBC API. This means that developers do not need to learn new APIs or a new query language to query data. It is also possible to provide SQL access to standard reporting tools.
While Jalapeño works best when used with an object database such as Caché, a Jalapeño object database schema can be exported to a corresponding relational schema using SQL standard DDL (data definition language), allowing developers to deploy their applications on a relational database. In this case, the Jalapeño API automatically uses standard JDBC calls for database connectivity. When connected to the Caché object database, a higher performance object-based protocol is used.
Installation and Prerequisites
The Jalapeño Persistence Library for Java comes pre-installed as part of the Caché Java binding (see Using Java with Caché
). When installing the database server on another system, you have the option to install only the runtime Java components.
This document assumes that you have some knowledge of the following:
The Java JVM or J2EE Application Server environment.
Some SQL or other database experience.
A modest amount of familiarity with Caché.
Applications created with versions of Jalapeno earlier than 2012.2 are incompatible with the server for Jalapeno 2012.2 or higher. To update an older application, use Jalapeno 2012.2 or higher to generate new schemas and recompile.
The Jalapeño Persistence Library for Java consists of the following components:
The Jalapeño SchemaBuilder is used to create Caché proxy classes (schemas) for a selected set of Java classes. This is effectively the reverse of the standard Caché Java binding architecture (see Using Java with Caché
), where Java proxy classes are generated from the original Caché classes.
At runtime, instances of the original POJO classes communicate (using TCP/IP sockets) with corresponding instances of the proxy classes on a Caché server. The following diagram illustrates this structure:
Jalapeño Client/Server Class Architecture