Skip to main content

Hibernate Support

The InterSystems Hibernate Dialect is InterSystems 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. Internally, SQL queries are executed using the InterSystems IRIS TSQL dialect. See the InterSystems IRIS TSQL DocumentationOpens in a new tab for details.

Requirements and Configuration

The following software must be installed on your system:

  • InterSystems IRIS® 2026.1

  • Hibernate 6.2 or 7.1

  • A supported version of Java JDK 1.8 or higher (see “Supported Java Technologies” in the InterSystems Supported Platforms document for this release).

Hibernate will load the InterSystems dialect automatically when you specify the correct configuration information.

In the Hibernate configuration files (either hibernate.properties or hibernate.cfg.xml), specify the connection information for your database, and the name of the InterSystems dialect class.

The following five configuration properties are required:

  • dialect — The fully qualified name of the InterSystems dialect class. The base dialect class is:

       org.hibernate.dialect.InterSystemsIRISDialect
    

    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.

  • driver_class — The fully qualified name of the InterSystems JDBC driver class:

       com.intersystems.jdbc.IRISDriver
    

    This class is in the InterSystems JDBC driver .jar file.

  • username — Username for the InterSystems IRIS namespace you want to access (default is _SYSTEM).

  • password — Password for the InterSystems IRIS namespace (default is SYS).

  • url — The URL for the InterSystems JDBC driver. The format for the URL is:

       jdbc:IRIS://<host>:<port>/<namespace>
    

    where <host> 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” in Using Java with InterSystems Software for more details).

A typical entry in hibernate.properties would contain the following lines (change url, username, and password as appropriate for your system)):

  hibernate.dialect org.hibernate.dialect.InterSystemsIRISDialect
  hibernate.connection.driver_class com.intersystems.jdbc.IRISDriver
  hibernate.connection.url jdbc:IRIS://127.0.0.1:1972/USER/
  hibernate.connection.username _SYSTEM
  hibernate.connection.password SYS

The following example shows the same information as it would appear in hibernate.cfg.xml:

  <hibernate-configuration>
    <session-factory>
      <property name="dialect">
        org.hibernate.dialect.InterSystemsIRISDialect
      </property>
      <property name="connection.driver_class">
        com.intersystems.jdbc.IRISDriver</property>
      <property name="connection.username">_SYSTEM</property>
      <property name="connection.password">SYS</property>
      <property name="connection.url">
        jdbc:IRIS://127.0.0.1:1972/USER
      </property>
    </session-factory>
  </hibernate-configuration>

Caution:

If the same property is set in both hibernate.properties and hibernate.cfg.xml, Hibernate will use the value from hibernate.cfg.xml.

FeedbackOpens in a new tab