beautypg.com

Caveatemptor_script.sql – HP Integrity NonStop H-Series User Manual

Page 359

background image








Caveatemptor_script.sql

(

<My SASH Home>\hibernate\samples\eg\dbconfig\caveatemptor_script.sql

)

This is the script file used to create database catalog, schema, and database tables for Caveat
Emptor application. The content of this file is:

log caveat.log;
drop schema auctioncat.auctionsch cascade;
drop catalog auctioncat;
create catalog auctioncat LOCATION ;
create schema auctioncat.auctionsch AUTHORIZATION “” LOCATION ZSD;
set schema auctioncat.auctionsch;
create table auctionitem (id bigint not null, seller bigint not null,
shortDescription varchar(200) not null, description varchar(1000),
ends timestamp, "CONDITION" integer, successfulBid bigint, primary key
(id)) LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
create table auctionuser (id bigint not null, userName varchar(10) not null, "password" varchar(15) not
null, email varchar(255), firstName varchar(50) not null, "initial" char(1), lastName varchar(50) not null,
primary key (id)) LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
create table bid (id bigint not null, isBuyNow char(1) not null, item bigint not null, amount float not
null, "datetime" timestamp not null, bidder bigint not null, primary key (id)) LOCATION <$datavol>
ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
create unique index auctionitem_seller on auctionitem (seller, shortDescription)
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
alter table auctionitem add constraint FKEECF7FD6F65B1FAF foreign key (successfulBid) references bid;
alter table auctionitem add constraint FKEECF7FD61107FE9B foreign key (seller)
references auctionuser;
create unique index auctionuser_username on auctionuser (userName)
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
create unique index auctionitem_item_amount on bid (item, amount)
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
alter table bid add constraint FK17CFDF43A3910 foreign key (bidder)
references auctionuser;
alter table bid add constraint FK17CFDEE6E7E98 foreign key (item)
references auctionitem;
create table hibernate_unique_key (next_hi integer )
LOCATION <$datavol> ATTRIBUTE EXTENT (16, 64), MAXEXTENTS 160;
insert into hibernate_unique_key values (1);

Customizing Caveat Emptor

359

This manual is related to the following products: