beautypg.com

Petclinic.hbm.xml, Applicationcontext-hibernate.xml, Petclinic.hbm.xml applicationcontext-hibernate.xml – HP Integrity NonStop H-Series User Manual

Page 154

background image

/WEB-INF/applicationContext-jdbc.xml
/WEB-INF/applicationContext-jpa.xml
-->


petclinic.hbm.xml

(

<Spring Home>\samples\petclinic\src\petclinic.hbm.xml

)

This Hibernate mapping file is used to map database tables with the corresponding Java objects.
This file was modified to use the Hibernate Generator class as

increment

in place of

identity

,

which is supported by the SQL/MX database. During the

Add

operation, the Hibernate Generator

class

increments

, selects the max ID value for each table, increments it by 1, and then adds the

new record with this incremented ID value.

Changes to the

petclinic.hbm.xml

file

The changes to the

petclinic.hbm.xml

are as follows:

The value

identity

was replaced with

increment

for all

tags in the

<Spring Home>\samples\petclinic\src\petclinic.hbm.xml

file.

Before the change:



After the change:



applicationContext-hibernate.xml

(

<Spring

Home>\samples\petclinic\war\WEB-INF\applicationContext-hibernate.xml

)

This file is used for configuring the Hibernate settings for PetClinic and was modified to add the
PetClinic database catalog and schema.

Changes to the

applicationContext-hibernate.xml

file

The

tag was replaced with

datasource

to add the PetClinic database catalog and

schema property.
Before the change:

destroy-method="close">
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}"
p:password="${jdbc.password}"/>

After the change:

destroy-method="close">



154

Customizing Sample Applications

This manual is related to the following products: