InterSystems Implementation Reference for Java Third Party APIs
The InterSystems Hibernate Dialect is an implementation of the Hibernate dialect interface. Since every vendor’s implementation of SQL is slightly different, the dialect interface allows vendors to create custom Hibernate mappings for a specific database. Vendor-provided dialect implementations are distributed as part of Hibernate.
This chapter provides technical details about the InterSystems Hibernate Dialect. The following topics are discussed:
Java Persistence Architecture (JPA) is the recommended persistence technology for complex object hierarchies in Java projects. InterSystems currently supports JPA via the Hibernate implementations of the JPA specifications. Hibernate is an open source framework from JBoss that acts as a wrapper around JDBC to provide object/relational mapping (ORM) services for relational databases. Hibernate provides a vendor-neutral persistence service, which may be a requirement for some projects.
The InterSystems Hibernate Dialect is an implementation of the Hibernate dialect interface. Since every vendor’s implementation of SQL is slightly different, Hibernate includes vendor-provided "dialects" that customize its mappings to specific databases. Current Hibernate distributions include a high performance, customized InterSystems dialect class.
Hibernate provides the infrastructure to persist objects to relational tables. Essentially, it is a wrapper around JDBC that allows you to focus on working with objects while transparently handling conversion between objects and tables in SQL queries. Hibernate can be used in most environments, but it is not always the best option. Here are some considerations to bear in mind:
Hibernate is helpful when you have a complex but static object model. You must know what your data looks like and how the classes interact before you map them to your InterSystems IRIS table model.
Hibernate is good for common CRUD operations with simple querying, but more complex queries may be easier to write, or more efficient, using JDBC directly.
This section provides instructions for setting up your system to use Hibernate with InterSystems IRIS. The instructions assume that the correct versions of both InterSystems IRIS and Hibernate are installed and operational.
The following software must be installed on your system:
The instructions in this chapter refer to the following directories:
Make the following changes to your system:
In the Hibernate configuration files (either hibernate.properties
), specify the connection information for your database, and the name of the InterSystems dialect class.
The following five configuration properties are required:
The fully qualified name of the InterSystems dialect class. The base dialect class is:
You can use a custom dialect class derived from this base class if you need to enable support for the Hibernate primary key generator classes.
The fully qualified name of the InterSystems JDBC driver:
Username for the InterSystems IRIS namespace you want to access (default is _SYSTEM
Password for the InterSystems IRIS namespace (default is SYS
The URL for the InterSystems JDBC driver. The format for the URL is:
is the IP address of the machine hosting InterSystems IRIS, <port>
is the SuperServer TCP port of your InterSystems IRIS instance, and <namespace>
is the namespace that contains your InterSystems IRIS database data (see Defining a JDBC Connection URL
for more details).
A typical entry in hibernate.properties
would contain the following lines (change url, username, and password as appropriate for your system)):
The following example shows the same information as it would appear in hibernate.cfg.xml
The InterSystems Hibernate dialect consists of four files that should be located as follows
Content Date/Time: 2019-02-14 22:44:31