Dynamic Web Development with Seaside

Buy PDF Buy Print

25.5GLORP: an Object-Relational Mapper

GLORP which stands for Generic Lightweight Object-Relational Persistence, is a meta-data driven object-relational mapper. GLORP is open-source (LGPL) and you can find more information at http://www.glorp.org/. GLORP is non-intrusive in the sense that the object model does not have to store foreign keys in objects and that you can map an arbitrary domain model to an arbitrary relational model.

GLORP allows you to manipulate databases with a low-level interface. You can create databases, create sessions, add/remove rows, select a row and so on. However this interface is low-level and GLORP offers a high-level interface. When you are using the higher-level API, GLORP watches for dirty objects (i.e., objects whose state has been changed since the transaction began), and then automatically writes those objects to the RDBMS when you commit the transaction. The required SQL is automatically generated and you don’t need to ever explicitly write any SQL yourself, or otherwise need to explicitly manipulate the rows yourself. In addition GLORP preserves object identity when objects are fetched several times from the database. GLORP uses a clever object cache.

GLORP uses meta-data to define the mapping between the objects and the relational database. The meta-data is a declarative description of the correspondence between an object and its database representation. It is used to drive reads, writes, joins, and anything else that is needed. SQL code should not ever have to be explicitly created, as it is autogenerated through the mappings (i.e., through the meta-data). In GLORP queries are expressed in terms of objects and composable expressions.

We will not cover GLORP in this book. We suggest reading the book An Introduction to Seaside by Michael Perscheid et al. as well as the GLORP documentation.

Add a Note

Copyright © 29 July 2014 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.