CHAPTER 17 PERSISTENCE

In this chapter, we are concerned with persisting our data in a relational database (we assume a familiarity with the Structured Query Language (SQL) (Beaulieu, 2005; Molinaro, 2006). For the Java developer, this would involve programming to the Java Database Connectivity (JDBC) API. While ultimately, so too does the Groovy programmer, much of the burden of developing with this API is shifted to the Groovy framework, which makes light of the work involved in manipulating sets of data extracted from a database. For example, iterators and closures allow us to easily traverse the rows of a database table.

17.1 SIMPLE QUERIES

Consider a database with a single table having the details of a number of bank accounts. The table, ...

Get Groovy Programming 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.