A persistence instance configuration is contained in a <persistence-instance> element. This element must have the following attributes:

Attribute Description
name

The name of the persistence instance. This name must be unique between all persistence instance configurations.

datasource-class-name

The fully-qualified name of the Java class from the database driver that implements the javax.sql.DataSource interface or the javax.sql.ConnectionPoolDataSource interface.

A <persistence-instance> element may also include zero or more <parameter> elements. Each <parameter> element identifies the name, Java type, and value of a configuration property of the datasource class using the following element attributes:

Attribute Description
name

The name of a JavaBean property defined by the datasource class.

type

The fully-qualified Java class name of the JavaBean property’s type.

value

The value that should be assigned to the configuration property.
Variables may be used in the construct of JavaBean property values. Variables are indicated using the ${...} syntax, where the value between the braces is the variable name. Rhino attempts to resolve the variable name by looking in the following places in this order:

  • The content of the $RHINO_HOME/config/config_variables file

  • Java system properties

  • User environment variables

Example

Below is an example of the default configuration that connects to a PostgreSQL database:

<persistence-instance datasource-class-name="org.postgresql.ds.PGSimpleDataSource" name="postgres">
    <parameter name="serverName" type="java.lang.String" value="${MANAGEMENT_DATABASE_HOST}"/>
    <parameter name="portNumber" type="java.lang.Integer" value="${MANAGEMENT_DATABASE_PORT}"/>
    <parameter name="databaseName" type="java.lang.String" value="${MANAGEMENT_DATABASE_NAME}"/>
    <parameter name="user" type="java.lang.String" value="${MANAGEMENT_DATABASE_USER}"/>
    <parameter name="password" type="java.lang.String" value="${MANAGEMENT_DATABASE_PASSWORD}"/>
    <parameter name="loginTimeout" type="java.lang.Integer" value="30"/>
    <parameter name="socketTimeout" type="java.lang.Integer" value="15"/>
    <parameter name="prepareThreshold" type="java.lang.Integer" value="1"/>
</persistence-instance>
Previous page Next page
Rhino Version 2.5.0