Book Image

Play Framework Essentials

By : Julien Richard-Foy
Book Image

Play Framework Essentials

By: Julien Richard-Foy

Overview of this book

Table of Contents (14 chapters)
Play Framework Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Persisting data


Obviously, you are free to use any persistence technology such as relational databases, document stores, key-value stores, and graph databases according to your needs. Nevertheless, this section gives insights on the recommended ways to integrate a persistence technology to your Play project.

As the persistence layer is usually independent of the HTTP layer, Play is agnostic to which persistence layer you use. However, most persistence layers need configuration settings, so you need a way to inject these settings to your persistence technology from your application. A common way to achieve this is to define a Play plugin. The next sections show how to integrate a relational database using the provided JDBC and JPA plugins.

Using a relational database

If you are using a relational database, chances are that your database API relies on JDBC. At some point, your database API will need a javax.sql.Connection object to work with and might use JDBC transactions.

Play comes with a JDBC...