In order to persist data, JPA needs a relational database; we will use the MySQL database, which is pretty popular among developers and can be downloaded for free from http://dev.mysql.com/downloads. It is recommended to download the latest stable release of MySQL 5.x and install it using the simple installation wizard.
We will create a database named appstore
; we will then add a user named jboss
and assign him all privileges on the schemas.
Open a shell under the bin
folder of your MySQL installation and launch the executable mysql
. Once logged in, execute the following commands:
CREATE DATABASE ticketsystem; USE ticketsystem; CREATE USER 'jboss'@'localhost' IDENTIFIED BY 'jboss'; GRANT ALL PRIVILEGES ON ticketsystem.* TO 'jboss'@'localhost' WITH GRANT OPTION;
Our simple schema will be made up of two tables—the SEAT
table, which contains the list of all available seats in the theatre and the SEAT_TYPE
table, which is used to categorize...