Manual

</session-factory>
</hibernate-configuration>
NOTE: The significance of the <session-factory> tag is discussed in the Opening a Session
for Database Operation section.
Defining the Connection URL
After you have specify the JDBC Type 4 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.
To define the connection URL, enter jdbc:t4sqlmx://<HP NonStop System IP
Address>:<Port No.> as the connection URL for the SQL/MX database in the
hibernate.cfg.xml under the <session-factory> tag as shown:
<property name="connection.url">jdbc:t4sqlmx://<HP NonStop System IP Address>:<Port No.></property>
Establishing the Connection
To establish the connection, specify the username and password of your NonStop system in the
hibernate.cfg.xml file 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 class name of a Hibernate dialect file
in the hibernate.cfg.xml file 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 shown:
<!-- Mapping files -->
<mapping resource="Employee.hbm.xml" />
The basic configuration is ready for you to perform database operation using Hibernate.
Opening a Session for Database Operation
To open a new session for database transaction, complete the following steps:
1. Configuring SessionFactory in the hibernate.cfg.xml File
2. Creating a New Session from the SessionFactory in Java
Configuring SessionFactory in the hibernate.cfg.xml File
Add the following lines in the hibernate.cfg.xml file to configure the Hibernate
SessionFactory.
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
Hibernate Framework Configurations for NonStop Systems 323