Chapter 4. Persistence Setups

4.1. Configuring Persistence for Business Central

Red Hat JBoss BPM Suite is configured to use an example data source with Java Naming and Directory Interface (JNDI) name java:jboss/datasources/ExampleDS. The example data source is not suitable for production.

To change the data source:

  1. Prepare your database:

    1. Go to the Product Downloads on the Customer Portal and select Red Hat JBoss BPM Suite.
    2. Download Red Hat JBoss BPM Suite 6.3.0 Supplementary Tools.
    3. Unzip jboss-brms-bpmsuite-6.3-supplementary-tools/ddl-scripts, for example into /tmp/ddl.
    4. Import the DDL script for your database into the database you want to use, for example:

      psql jbpm < /tmp/ddl/postgresql/postgresql-jbpm-schema.sql
  2. Install the Java Database Connectivity (JDBC) driver onto your application plaform. For example, to deploy a PostgreSQL JDBC driver:

    1. Copy your JDBC jar file into EAP_HOME/modules/org/postgres/main/.
    2. Create EAP_HOME/modules/org/postgres/main/module.xml with the following content:

      <?xml version="1.0" ?>
      <module xmlns="urn:jboss:module:1.1" name="org.postgres">
          <resources>
              <!-- Change the name of the JDBC driver to match yours. -->
              <resource-root path="postgresql-9.4-1202.jdbc42.jar"/>
          </resources>
          <dependencies>
              <module name="javax.api"/>
              <module name="javax.transaction.api"/>
          </dependencies>

      For further information about deploying JDBC drivers, see Install a JDBC Driver as a Core Module of the Red Hat JBoss Enterprise Application Platform Administration and Configuration Guide.

  3. Create a new data source:

    1. Open EAP_HOME/standalone/configuration/standalone.xml and locate <datasources>.
    2. Add your data source and the driver:

      <!-- Default data source not suitable for production, now disabled. -->
      <datasources>
          <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="false" use-java-context="true">
              <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
              <driver>h2</driver>
              <security>
                  <user-name>sa</user-name>
                  <password>sa</password>
              </security>
          </datasource>
      
          <!-- The new data source configuration. -->
          <datasource jndi-name="java:jboss/datasources/PostgresqlDS" pool-name="PostgresqlDS" enabled="true">
              <connection-url>jdbc:postgresql://localhost:5432/jbpm</connection-url>
              <driver>postgresql-9.4-1202.jdbc42.jar</driver>
              <security>
                  <user-name>jbpm</user-name>
                  <password>jbpm</password>
              </security>
          </datasource>
      
          <!-- The drivers section. -->
          <drivers>
              <driver name="h2" module="com.h2database.h2">
                  <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
              </driver>
              <!-- Register your new driver. -->
              <driver name="postgres" module="org.postgres">
                  <driver-class>org.postgresql.Driver</driver-class>
              </driver>
          </drivers>
      </datasources>

      For more information, see Example PostgreSQL Datasource of the Red Hat JBoss Enterprise Application Platform Administration and Configuration Guide.

  4. Register the data source in Business Central:

    1. Open EAP_HOME/standalone/deployments/business-central.war/WEB-INF/classes/META-INF/persistence.xml.
    2. Locate the <jta-data-source> tag and change it to the JNDI name of your data source, for example:

      <jta-data-source>java:jboss/datasources/PostgresqlDS</jta-data-source>
    3. Locate the <properties> tag and change the hibernate.dialect property, for example:

      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />