Hibernate.properties – HP Integrity NonStop J-Series User Manual

Page 213

Advertising
background image

2.

Modify the hibernate.cfg.xml file:

Add a reference for the Hibernate mapping file under the <session-factory> tag.

<mapping resource="Employee.hbm.xml" />

Add a reference for the Hibernate dialect file by including the following property tag
under the <session-factory> tag.

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

Enable auto-creation of database tables using the Hibernate mapping file by including
the following property tag under the <session-factory> tag.

<property name="hibernate.hbm2ddl.auto">create</property>

The hibernate.cfg.xml file now appears as:

<?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="hibernate.hbm2ddl.auto">create</property>
<property name="show_sql">true</property>

<!-- SQL Dialect to use. Dialects are database specific -->
<property name="dialect">
org.hibernate.dialect.SqlmxDialect
</property>
<!-- Mapping files -->
<mapping resource="Employee.hbm.xml" />
</session-factory>
</hibernate-configuration>

hibernate.properties

The hibernate.properties file includes information on the SQL/MX database.

To create the hibernate.properties file:
1.

On the Project Explorer frame, right-click EmployeeInfo and select New > File.

The New File dialog box appears.

2.

Change the parent folder to the EmployeeInfo/src directory. In the File name field, type
hibernate.properties

. Click Finish.

The hibernate.properties file is created.

Overview of EmpIoyeeInfo

213

Advertising
This manual is related to the following products: