Adding persistence to our application

In order to persist data, JPA needs a relational database; we will use the PostgreSQL database, which is pretty popular among developers and can be downloaded for free from http://www.postgresql.org/download/. It is recommended to download the latest stable release of PostgreSQL 9.x and install it using the simple installation wizard. If you don't need a full-blown database, then keep in mind that later we will also show you how to use an in-memory database provided by WildFly, which can be a really useful alternative during development.

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

Get Java EE 7 Development with WildFly 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.