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

1134 questions
19
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,091
  • 15
  • 22
17
votes
1 answer

Automatic logging of DataMapper queries

I am working on a simple app in Sinatra with DataMapper. I want to see the queries that DM is created for my various chained finders, etc. I have tried: DataMapper::Logger.new(STDOUT, :debug) in my configure do ... end block in an environment.rb…
kEND
  • 7,379
  • 3
  • 19
  • 13
16
votes
1 answer

_mysql_init not found when using DataMapper

I have a simple MySQL table: % mysql -u rampion dev -e 'describe person' +-------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra …
rampion
  • 87,131
  • 49
  • 199
  • 315
13
votes
3 answers

Spork and cache_classes problem with rspec, factory_girl and datamapper

I've got a problem with Spork test server. If I set config.cache_classes = false in config/environments/test.rb then specs start to rasie errors. Failure/Error: task = Factory(:something, :foo => @foo, :bar => @bar) …
sparrovv
  • 6,894
  • 2
  • 29
  • 34
13
votes
3 answers

Javascript node.js ORM that follows data-mapper pattern

I've been working with active record and data mapper implementations of ORM enough to know the problems with using active record implemented ORM in my large projects. Right now I'm thinking to migrate one of my projects to node.js and trying to find…
pleerock
  • 18,322
  • 16
  • 103
  • 128
13
votes
1 answer

What is the correct way to setup database with DataMapper and Sinatra on production server?

From the DataMapper document, I think there are at least four functions need to be called to have database setup: DataMapper.setup(:default, 'sqlite:///path/to/project.db') DataMapper.finalize DataMapper.auto_migrate! DataMapper.auto_upgrade! In…
Wen
  • 1,230
  • 1
  • 14
  • 28
11
votes
2 answers

Why does active record pattern not work with rich domain models?

I'm reading the architectural patterns chapter of POEAA, and Fowler says that "As the domain logic gets more complicated and you begin moving toward a rich Domain Model (116), the simple approach of an Active Record (160) starts to break down. The…
blacktie24
  • 4,985
  • 6
  • 41
  • 52
11
votes
3 answers

Using the Data Mapper Pattern, Should the Entities (Domain Objects) know about the Mapper?

I'm working with Doctrine2 for the first time, but I think this question is generic enough to not be dependent on a specific ORM. Should the entities in a Data Mapper pattern be aware - and use - the Mapper? I have a few specific examples, but they…
Tim Lytle
  • 17,549
  • 10
  • 60
  • 91
10
votes
1 answer

Adding an ORM to a Sinatra app; Is there an ideal one with less issues and good performance?

I am looking to add an ORM to my existing Sinatra app. I went through Datamapper, Sequel and ActiveRecord though I haven't tried ActiveRecord yet. Datamapper seems easy but I am constantly facing a issue discussed in "What ORM to use in one process…
abhijit
  • 1,958
  • 3
  • 28
  • 39
10
votes
2 answers

How does the ActiveRecord pattern differ from the Domain Object or Data Mapper pattern?

I was looking at DataMapper, which appeared at first glance to use the ActiveRecord ORM pattern. Other people said that it uses the DataMapper and/or the Domain Object pattern. What is the difference between those patterns?
Joe Van Dyk
  • 6,828
  • 8
  • 57
  • 73
10
votes
2 answers

Data Mapper Pattern: Complexe query from Service Layer

I'm sing the Data Mapper Pattern in Zend Framework. This works well so far, but now I got to a point where I need your help/opinion. So let's start with the Code: We got a table with several Persons: CREATE TABLE `persons` ( `id` int(11) NOT NULL…
Matthias Bayer
  • 1,169
  • 1
  • 8
  • 15
10
votes
2 answers

Handling relationships with the Data Mapper pattern

I am using the Data Mapper Pattern and I am wondering what is the best way to handle relationships with that pattern. I spent a lot of time searching for solutions in Google and Stack overflow, I found some but I am still not completely happy about…
Vincent
  • 101
  • 5
9
votes
3 answers

LoadError: no such file to load -- dm-sqlite-adapter

I'm starting my first Sinatra App and I'm trying to use DataMapper. Everything is in the very early stages, as I can't get it to actually create the DB. I get "LoadError: no such file to load -- dm-sqlite-adapter" when I try to visit my page.…
YuKagi
  • 2,451
  • 3
  • 21
  • 26
9
votes
4 answers

What's the significant difference between active record and data mapper based ORMs?

Like doctrine(active record) and Xyster(data mapper),what's the difference?
user198729
  • 61,774
  • 108
  • 250
  • 348
8
votes
2 answers

Displaying Error Message with Sinatra

I'm writing a simple app that takes standard input from the user. As for the email entry, I have it verify if it is in a standard email format and then have it list the problems like this when a new instance is going to be saved: u =…
captDaylight
  • 2,224
  • 4
  • 31
  • 42
1
2
3
75 76