Chapter 6. Database Access and the Future of ORM
An essential component found in almost any web application involves the storage and retrieval of data in a persistent store. Whether relational or NoSQL based, a database often occupies the most important place since it holds the application data. When a technology stack becomes a legacy and needs to be refactored or ported to a new one, the database is usually the starting point since it holds the domain knowledge.
In this chapter, we are first going to study how to integrate and reuse persistence frameworks inherited from Java that deal with Object Relational Mapping (ORM) such as those supporting Java Persistence API (JPA), for example, Hibernate and EclipseLink. We will then experiment with the default persistence framework available in the Play Framework, Anorm. Finally, we will introduce and discover a Scala alternative to ORM and a rather novel approach that adds type safety and composition to the more traditional SQL-based queries,...