Chapter 5. Working with Data

The MVC approach talks about the model, view, and controller. We have seen views and controllers in detail in the previous chapters and neglected models to quite an extent. Models are an important part of MVC; the changes made to a model are reflected in the views and controllers using them.

Web applications are incomplete without data transactions. This chapter is about designing models and handling DB transactions in Play.

In this chapter, we will cover the following topics:

  • Models
  • JDBC
  • Anorm
  • Slick
  • ReactiveMongo
  • A Cache API

Introducing models

A model is a domain object, which maps to database entities. For example, a social networking application has users. The users can register, update their profile, add friends, post links, ...

Get Mastering Play Framework for Scala 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.