Defining the connection url, Establishing the connection, Defining the hibernate dialect for sql/mx database – HP Integrity NonStop H-Series User Manual
Page 323: Specifying the mapping resources, Opening a session for database operation

NOTE:
The significance of the
<session-factory>
tag is discussed in the
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://
Address>:
as the connection URL for the SQL/MX database in the
hibernate.cfg.xml
under the
<session-factory>
tag as shown:
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.
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.
org.hibernate.dialect.SqlmxDialect
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:
For example:
If the mapping file used in your application is
Employee.hbm.xml
, specify it as shown:
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.
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
.
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
Hibernate Framework Configurations for NonStop Systems
323