Defining the connection url, Establishing the connection, Defining the hibernate dialect for sql/mx database – HP Integrity NonStop J-Series User Manual

Page 108: Specifying the mapping resources

Advertising
background image

...
...

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

NOTE:

The significance of the <session-factory> tag is explained in

“Opening a Session

for Database Operation” (page 109)

.

Defining the Connection URL

After you have specified the JDBC driver, enter the location of the SQL/MX server. URLs referring
to SQL/MX use the jdbc: protocol and have the server host, port number embedded within
the URL. Define the connection URL as follows:

For Type 2 Driver:

Enter the connection URL as jdbc:sqlmx:// under the <session-factory> tag as shown:

<property name="connection.url">jdbc:sqlmx://</property>

For Type 4 Driver:

Enter the connection URL as jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port
No.>

under the <session-factory> tag as shown:

<property name="connection.url">jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port No.></property>

Establishing the Connection

For Type 2 Driver:

Add the following syntax under the <session-factory> tag:

<property name="connection.username"></property>
<property name="connection.password"></property>

Do not specify the username and password.

For Type 4 Driver:

Specify the username and password of your NonStop system under the <session-factory>
tag as shown.

<property name="connection.username"><HP NonStop Username></property>
<property name="connection.password"><HP NonStop Password></property>

Defining the Hibernate Dialect for SQL/MX Database

Enter org.hibernate.dialect.SqlmxDialect as the Hibernate dialect class name for
SQL/MX database under the <session-factory> tag.

<property name="dialect">
org.hibernate.dialect.SqlmxDialect
</property>

This dialect file allows Hibernate to generate SQL that is optimized for the SQL/MX database.

Specifying the Mapping Resources

Specify all the mapping files (.hbm) in the <mapping resource> tag as shown:

<!-- Mapping files -->
<mapping resource="<Name of the .hbm file>" />

For example:

If the mapping file used in your application is Employee.hbm.xml, specify it as:

<!-- Mapping files -->
<mapping resource="Employee.hbm.xml" />

108 Hibernate Framework

Advertising
This manual is related to the following products: