Hibernate Connector

JPA

LeanXcale includes a Hibernate connector that enables you to connect to LeanXcale through your Hibernate application as usual.

1. Installation

To use the Hibernate connector, simply include the dependency in your maven configuration:

<dependency>
  <groupId>com.leanxcale.connectors</groupId>
  <artifactId>hibernate-connector</artifactId>
  <version>1.8.34</version>
</dependency>

Be sure to include the LeanXcale public Maven repository in your Maven configuration:

  <repositories>
    <repository>
      <id>maven-releases</id>
      <url>https://nexus.leanxcale.com/repository/maven-releases</url>
    </repository>
  </repositories>

If you don’t use maven or you prefer to include the libraries in your project manually, then download the Hibernate Connector and the JDBC driver from the Drivers page.

2. Usage

LeanXcale provides the required Hibernate dialect and driver to configure Hibernate:

  • dialect: com.leanxcale.connector.hibernate.LxDialect

  • jdbc driver: com.leanxcale.client.Driver

So, just modify your Hibernate config with these values and the connection properties, for example, configuring Hibernate using xml config file it should look like:

<hibernate-configuration>
  <session-factory>
    <property name="hibernate.connection.driver_class">com.leanxcale.client.Driver</property>
    <property name="hibernate.connection.url">${LX_URL}</property>
    <property name="hibernate.connection.username">${LX_USER}</property>
    <property name="hibernate.connection.password">${LX_PWD}</property>
    <property name="hibernate.dialect">com.leanxcale.connector.hibernate.LxDialect</property>
    <property name="hibernate.globally_quoted_identifiers">true</property>

    ...

  </session-factory>
</hibernate-configuration>

Please note that the LeanXcale’s Hibernate connector requires setting the Hibernate property "globally_quoted_identifiers" to true.