Questions tagged [datamapper]

Architectural pattern for separating application logic from storage.

Objects and relational databases have different mechanisms for structuring data.

The Data Mapper is a layer of software that separates the in-memory objects from the database. Its responsibility is to transfer data between the two and also to isolate them from each other. With Data Mapper the in-memory objects needn't know even that there's a database present; they need no SQL interface code, and certainly no knowledge of the database schema.

Pattern definition: http://martinfowler.com/eaaCatalog/dataMapper.html

1130 questions
137
votes
5 answers

What is the difference between the Data Mapper, Table Data Gateway (Gateway), Data Access Object (DAO) and Repository patterns?

I'm trying to brush up on my design pattern skills, and I'm curious what are the differences between these patterns? All of them seem like they are the same thing - encapsulate the database logic for a specific entity so the calling code has no…
Wayne Molina
  • 17,811
  • 24
  • 93
  • 156
42
votes
2 answers

How do I truncate tables properly?

I'm using datamapper with ruby to store data to certain tables. Several of the tables have very large amounts of information and I want to clear them out when the user 'rebuilds database' (it basically deletes everything and re-calculates data). I…
Tallboy
  • 11,480
  • 11
  • 67
  • 151
41
votes
1 answer

Repository and Data Mapper pattern

After a lots of read about Repository and Data Mapper I decided to implement those patterns in a test project. Since I'm new to these I'd like to get your views about how did I implement those in a simple project. Jeremy Miller says : Do some sort…
saber
  • 5,999
  • 10
  • 49
  • 83
29
votes
1 answer

How is the Data Mapper pattern different from the Repository Pattern?

I found two patterns which appear to have the same goal - what is the difference? http://martinfowler.com/eaaCatalog/dataMapper.html http://martinfowler.com/eaaCatalog/repository.html
John Smith
  • 2,797
  • 5
  • 27
  • 30
28
votes
2 answers

DataMapper vs ActiveRecord in Rails 3

I am curious on what you guys think about DataMapper and what benefits does it bring over the new and improved ActiveRecord in Rails 3. I appreciate your opinions.
Ivo Sabev
  • 5,066
  • 1
  • 24
  • 38
28
votes
2 answers

What exactly is the difference between a data mapper and a repository?

Well I've been trying to find out the difference between data mapper and repository, but up to now I still have not. It seems to me that the expert programmer said "Repository is another layer of abstraction over the mapping layer where query…
Lord Yggdrasill
  • 2,453
  • 4
  • 22
  • 37
25
votes
2 answers

Is Data Mapper a more modern trend than Active Record

I've come across a couple of ORMs that recently announced they are planning to move their implementation from Active Record to Data Mapper. My knowledge of this subject is very limited. So a question for those who know better, is Data Mapper newer…
jblue
  • 4,100
  • 4
  • 41
  • 79
22
votes
2 answers

In Doctrine 2 can the Fetch Mode (Eager/Lazy etc.) be changed at runtime?

I have entities which I would like to eagerly load , and on other ocassions lazy (or even extra lazy) load. My mappings have no fetch mode declared in my YAML- so they use the default (lazy loading). Currently the only way to eagerly load is to by…
calumbrodie
  • 4,642
  • 5
  • 31
  • 61
21
votes
6 answers

When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying

A colleague of mine is currently designing SQL queries like the one below to produce reports, which are displayed in excel files through an external data query. At present, only reporting processes on the DB are required (no CRUD operations). I am…
user251732
  • 215
  • 2
  • 6
21
votes
3 answers

Data Mapper and Relationships: Implementation strategies?

I've almost finished my Data Mapper, but now I'm at the point where it comes to relationships. I will try to illustrate my ideas here. I wasn't able to find good articles / informations on this topic, so maybe I'm re-inventing the wheel (for sure I…
openfrog
  • 37,829
  • 61
  • 213
  • 364
21
votes
5 answers

Can DataMapper still be used for Rails?

I'm looking to use a more separated system for my models in a Ruby on Rails project. It looked like the solution was DataMapper. However, I see that none of their repositories have been updated in the last year, and when installed in a Rails 4…
Jonah
  • 9,535
  • 5
  • 39
  • 74
20
votes
5 answers

Are there any Ruby ORMs which use cursors or smart fetch?

I'm looking for a Ruby ORM to replace ActiveRecord. I've been looking at Sequel and DataMapper. They look pretty good however none of them seems to do the basic: not loading everything in memory when you don't need it. I mean I've tried the…
mb14
  • 20,914
  • 4
  • 54
  • 97
19
votes
2 answers

Jackson: how to serialize only annotated properties

I would like to define my custom serialization strategy (which fields to include), while using Jackson. I know, that I can do it with views/filters, but it introduces very bad thing - using string-representation of field names, which automatically…
Denis Kulagin
  • 7,244
  • 13
  • 50
  • 104
19
votes
3 answers

Data Mapper Pattern

Up until now I've been using Active records in all my c# database driven applications. But now my application requires my persistence code being split from my business objects. I have read a lot of posts regarding Martin Fowler's data mapping…
MegaByte
  • 6,445
  • 10
  • 34
  • 33
18
votes
2 answers

Who should handle the conditions in complex queries, the data mapper or the service layer?

this question did a very good job of clearing my confusion a bit on the matter, but I'm having a hard time finding reliable sources on what the exact limitations of the service layer should be. For this example, assume we're dealing with books, and…
orourkek
  • 2,071
  • 14
  • 22
1
2 3
75 76