Data mapper pattern
   HOME

TheInfoList



OR:

In
software engineering Software engineering is a systematic engineering approach to software development. A software engineer is a person who applies the principles of software engineering to design, develop, maintain, test, and evaluate computer software. The term '' ...
, the data mapper pattern is an
architectural pattern An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. The architectural patterns address various issues in software engineering, such as computer hardware perfor ...
. It was named by Martin Fowler in his 2003 book ''Patterns of Enterprise Application Architecture''. 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 A data access layer (DAL) in computer software is a layer of a computer program which provides simplified access to data stored in persistent storage of some kind, such as an entity-relational database. This acronym is prevalently used in Microsof ...
that performs bidirectional transfer of data between a persistent data store (often a
relational database A relational database is a (most commonly digital) database based on the relational model of data, as proposed by E. F. Codd in 1970. A system used to maintain relational databases is a relational database management system (RDBMS). Many relati ...
) 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. This is useful when one needs to model and enforce strict business processes on the data in the domain layer that do not map neatly to the persistent data store. The layer is composed of one or more mappers (or
Data Access Object In software, a data access object (DAO) is a pattern that provides an abstract interface to some type of database or other persistence mechanism. By mapping application calls to the persistence layer, the DAO provides data operations without expo ...
s), 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 A framework is a generic term commonly referring to an essential supporting structure which other things are built on top of. Framework may refer to: Computing * Application framework, used to implement the structure of an application for an op ...
for many programming environments.


Java/.NET

*
MyBatis MyBatis is a Java persistence framework that couples objects with stored procedures or SQL statements using an XML descriptor or annotations. MyBatis is free software that is distributed under the Apache License 2.0. MyBatis is a fork of iBATI ...
persistence framework * Hibernate (
NHibernate NHibernate is an object–relational mapping (ORM) solution for the Microsoft .NET platform. It provides a framework for mapping an object-oriented domain model to a traditional relational database. Its purpose is to relieve the developer from a ...
) persistence framework


Node.js / TypeScript


Bookshelf.js
library
TypeORM
library
Massive.js
library
Prisma

Objection.js
library
MikroORM
library


PHP

*
Atlas An atlas is a collection of maps; it is typically a bundle of maps of Earth or of a region of Earth. Atlases have traditionally been bound into book form, but today many atlases are in multimedia formats. In addition to presenting geogra ...
ORM (data mapper, table data gateway, query builder, and PDO wrapper) * Doctrine2 Object Relational Mapper (ORM) and the Database Abstraction Layer
Cycle
ORM (PHP DataMapper ORM and Data Modelling Engine)


Python

* SQLAlchemy library
mincePy
library


Ruby


DataMapper
library (Actually this library implemented the Active Record design pattern, its successor, DataMapper 2 (no
ROM
aimed to actually implement the design pattern it was named after)


Elixir


Ecto
persistence framework


See also

* *


References

{{DEFAULTSORT:Data mapper pattern Software design patterns Architectural pattern (computer science)