Manual

Configuration cfg = new Configuration()
.addResource("Name of mapping file#1")
.addResource("Name of mapping file#2");
For example,
If the mapping file used in your application is Item.hbm.xml and Bid.hbm.xml, specify it as
shown.
Configuration cfg = new Configuration()
.addResource("Item.hbm.xml")
.addResource("Bid.hbm.xml");
The basic configuration is ready for you to perform database operation using Hibernate.
Closing the Session
Once the database operation is complete, close the session to deallocate the memory.
Add the following line of code when you complete the database operation.
session.close();
Configuring JDBC Type 4 Driver for SQL/MX Database
In a typical Hibernate application, you can configure the JDBC Type 4 driver for SQL/MX database
using either one of the following preferred options:
Configuring JDBC Type 4 Driver for SQL/MX Database using hibernate.cfg.xml
Configuring JDBC Type 4 Driver for SQL/MX Database using hibernate.properties
Configuring JDBC Type 4 Driver for SQL/MX Database using hibernate.cfg.xml
The advantage of using this approach is the externalization of mapping file names to configuration.
To complete the database operation in a Hibernate application using the JDBC Type 4 driver for
the SQL/MX database, complete the following steps:
1. Specifying the JDBC Type 4 Driver for SQL/MX Database
2. Defining the Connection URL
3. Establishing the Connection
4. Defining the Hibernate Dialect for SQL/MX Database
5. Specifying the Mapping Resources
6. Opening a Session for Database Operation
7. Closing the Session
Specifying the JDBC Type 4 Driver for SQL/MX Database
To specify the JDBC Type 4 driver for SQL/MX database, enter
com.tandem.t4jdbc.SQLMXDriver as the name of the JDBC Type 4 driver class for the
SQL/MX database in the hibernate.cfg.xml file under the <session-factory> tag as
shown below.
<?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>
<session-factory>
<property name="connection.driver_class">com.tandem.t4jdbc.SQLMXDriver</property>
...
...
...
...
322 Configuring Hibernate Applications on NonStop Systems