Adding persistence to our application

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.

Setting up the database

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 ...

Get JBoss AS 7 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.