Modified file, Hibernate.cfg.xml – HP Integrity NonStop J-Series User Manual

Page 225

Advertising
background image

alter table PERSON_EMAIL_ADDR add constraint FKA54215FEB0A1327A foreign key (PERSON_ID)
references PERSON;

alter table PERSON_EVENT add constraint FKAD91D910A8B41A9A foreign key
(EVENT_ID) references EVENTS;

create unique index eventcat_person on PERSON(PERSON_ID) LOCATION <$datavol>
ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;

create unique index eventcat_person_event on PERSON_EVENT(EVENT_ID, PERSON_ID)
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;

create unique index eventcat_emails on PERSON_EMAIL_ADDR(PERSON_ID)
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;

create table hibernate_unique_key (next_hi integer ) LOCATION <$datavol>
ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;

insert into hibernate_unique_key values (1);

Modified File

Hibernate.cfg.xml

(<My SASH Home>\hibernate\samples\web\src\main\resources)

This is the hibernate configuration file for EventManager that contains hibernate connection
properties and hbm resource mapping.

Changes to the Hibernate.cfg.xml file

This file was modified to remove the default connection-related hibernate properties.
Before the change:

<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:hsql://localhost</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>

<!-- Enable Hibernate's current session context -->
<property name="current_session_context_class">
org.hibernate.context.ManagedSessionContext</property>

<!-- Disable the second-level cache -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider</property>

<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
<mapping resource="org/hibernate/tutorial/domain/Person.hbm.xml"/>

</session-factory>

</hibernate-configuration>

Customizing EventManager 225

Advertising
This manual is related to the following products: