Java Reference
In-Depth Information
Setting up the database
We will create a database named ticketsystem ; we will then add a user named jboss
and assign him/her all privileges on the schemas.
Open a shell under the bin folder of your PostgreSQL installation and launch the execut-
able psql -U postgres . Once logged in with the password from your installation, ex-
ecute the following commands:
CREATE DATABASE ticketsystem;
CREATE USER jboss WITH PASSWORD 'jboss';
GRANT ALL PRIVILEGES ON DATABASE ticketsystem TO jboss;
Our simple schema will be made up of two tables: the SEAT table, which contains the list
of all the available seats in the theatre, and the SEAT_TYPE table, which is used to cat-
egorize the seat types. The two tables are in a 1-n relationship and the SEAT table hosts a
foreign key that relates to the ID of the SEAT_TYPE table. We will, however, let JPA gen-
erate the schema for us, based on our class hierarchy, which we will model in a moment.
Search WWH ::




Custom Search