Jump to content

Data mapper pattern

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Jrc (talk | contribs) at 09:51, 19 June 2017 (Add Bookshelf.js). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In software engineering, the data mapper pattern is an architectural pattern. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture.[1] The interface of an object conforming to this pattern would include functions such as Create, Read, Update, and Delete, that operate on objects that represent domain entity types in a data store.

A Data Mapper is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (often a relational database) and an in-memory data representation (the domain layer). The goal of the pattern is to keep the in-memory representation and the persistent data store independent of each other and the data mapper itself. The layer is composed of one or more mappers (or Data Access Objects), performing the data transfer. Mapper implementations vary in scope. Generic mappers will handle many different domain entity types, dedicated mappers will handle one or a few.

Implementations

Implementations of the concept can be found in various frameworks for many programming environments.

Java/.NET

Node.js

PHP

  • Doctrine2 Object Relational Mapper (ORM) and the Database Abstraction Layer[2]

Python

Ruby

Elixir

  • Ecto persistence framework

See also

References

  1. ^ Fowler, Martin (2003). Patterns of enterprise application architecture. Addison-Wesley. ISBN 978-0-321-12742-6.
  2. ^ "Doctrine2 and ActiveRecord – Doctrine2". Doctrine2.