beautypg.com

G customizing sample application, Customizing caveat emptor, Modified file – HP Integrity NonStop H-Series User Manual

Page 355: Main.java, Added files, Hibernate.properties, Appendix g: customizing sample application, Customizing sample, Application

background image

G Customizing Sample Application

Customizing Caveat Emptor

To customize Caveat Emptor, one file was modified and five files were added.
Modified File

Main.java

Added Files

hibernate.properties

setenv

build_jdbct2.xml

build_jdbct4.xml

Caveatemptor_script.sql

Modified File

Main.java

(<Hibernate Home>\eg\org\hibernate\auction\Main.java)

This is the class file that performs all database operations and is an entry point for the Caveat
Emptor application.

Changes in the

Main.java

file:

Change the value of

Environment.HBM2DDL_AUTO

property to

false

to avoid auto

creation of database tables by Hibernate

.

NOTE:

The default value of

Environment.HBM2DDL_AUTO

is

create

.

For example:
Before the change:

Configuration cfg = new Configuration()
.addClass(AuctionItem.class)
.addClass(Bid.class)
.addClass(User.class)
.setProperty(Environment.HBM2DDL_AUTO, "create");
//cfg.setProperty("hibernate.show_sql", "true");

After the change:

Configuration cfg = new Configuration()
.addClass(AuctionItem.class)
.addClass(Bid.class)
.addClass(User.class)
.setProperty(Environment.HBM2DDL_AUTO, "false");
//cfg.setProperty("hibernate.show_sql", "true");

Added Files

hibernate.properties

(

<My SASH Home>\hibernate\samples\eg\hibernate.properties

)

Customizing Caveat Emptor

355

This manual is related to the following products: