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
5
votes
2 answers

Use DataMapper instead of ActiveRecord

DataMapper idea is definitely better than ActiveRecord. It has one API for a variety of data stores, including RDBMS and NoSQL stores. DataMapper is much smarter then ActiveRecord. It has "Strategic Eager Loading". This feature single-handedly…
5
votes
3 answers

Codeigniter Datamapper ORM php 7 static issue

When I upgraded my server to php7 codeigniter and in particular datamapper ORM gives me this error... Message: Accessing static property DataMapper::$config as non static Filename: libraries/datamapper.php Line Number: 6474 the function in…
galipmedia
  • 77
  • 5
5
votes
2 answers

Rails 3: ActiveRecord vs. DataMapper (vs. ???) for Legacy MySQL Databases

Which ORM is best to use with a new Rails 3 app against a legacy MySQL 5.1 database? I do not expect to ever run a migration against this database (though the schema may change from time to time), but I will certainly be writing to it.
Mark Richman
  • 26,790
  • 23
  • 85
  • 150
5
votes
1 answer

Undefined method auto_upgrade! when pushing Sinatra/DataMapper app to Heroku

Does anybody know the magic incantation required to get a Sinatra application that uses DataMapper up and running on Heroku's Bamboo stack? The Bamboo stack doesn't include any pre-installed system gems and no matter what combination of gems I try I…
John Topley
  • 107,187
  • 45
  • 188
  • 235
5
votes
2 answers

DataMapper: Create new record or update existing

Does DataMapper provide a convenient way to create a new record when none exists or update an existing one? I couldn't find anything in the API documentation. This is what I have at the moment which doesn't seem very elegant: foo = Foo.get(id) if…
John Topley
  • 107,187
  • 45
  • 188
  • 235
5
votes
1 answer

Is there active development going on IBatis.Net DataMapper?

Is there active development going on IBatis.Net DataMapper? Do they have version for .Net 3.5. I saw lots of activity on iBatis Java DataMapper as they are planning to release iBatis3 with annotation support. What is the status of its .Net…
Amitabh
  • 51,891
  • 40
  • 102
  • 154
5
votes
1 answer

LoadError: cannot load such file -- data_mapper Why?

I am working on a Sinatra application where I would like to use data_mapper & sqlite3. in app.rb I have: require 'sinatra' require 'data_mapper' in the console when I do $ gem list I get(list somewhat edited to reflect db gems: * LOCAL GEMS…
user3277225
  • 441
  • 1
  • 5
  • 16
5
votes
1 answer

How to load a one-to-many relationship in Data Mapper?

While I'll go for the Ghost pattern in a 1:1 relationship, I'm not sure if this is sufficient in a 1:n relationship. For example, when I load an Order object that may have a hundred Item objects, I would first assign NULL to the items property. The…
openfrog
  • 37,829
  • 61
  • 213
  • 364
5
votes
1 answer

Ruby Datamapper table inheritance with associations

I started learning Datamapper and what I liked about it was that I can write my models with real inheritance. Now I wonder, if it is possible to be more advanced about this: class Event include DataMapper::Resource property :id, Serial …
Debilski
  • 63,532
  • 11
  • 107
  • 132
5
votes
3 answers

Datamapper: report why I can't destroy record

I'm setting up my db model using datamapper and dm-contraints. I have two models which have a many to many relationship but when I try to destroy one, the only message I get is false. Is it possible to get datamapper to give me more feedback one…
Gerard
  • 4,688
  • 5
  • 48
  • 76
5
votes
2 answers

DataMapper SQLite Error when creating new database

I am new to Sinatra and I am trying to make a database using SQLite3 and Datamapper. I installed both gems and also the adaptor and then tried to execute this code in a file: #config require 'sinatra' require 'sinatra/contrib' if…
Amja
  • 533
  • 3
  • 17
5
votes
1 answer

How to implement Data Mapper / Repository persistence patterns for diverse data sources?

I am writing a new website project pretty much from scratch. The project is in C# but my background is in PHP (the pseudo-code below is a bit if a mixture, trying to be both succinct and declarative). The problem I need to retrieve configuration…
5
votes
2 answers

Zend Framework: Models, Mappers; Default Fields in Mappers & Field Operations in Models?

I'm creating a simple ORM in Zend Framework, to roughly encapsulate a public library application, using the DbTable/Mapper/Model approach. I'm not sure if the way I'm doing my User-related classes is right, though, as I have some logic in…
5
votes
5 answers

Why does DataMapper use mixins vs inheritance?

So I'm just curious about this: DataMapper uses a mixin for its Models class Post include DataMapper::Resource While active-record uses inheritance class Post < ActiveRecord::Base Does anyone know why DataMapper chose to do it that way (or why…
cloudhead
  • 14,909
  • 6
  • 38
  • 35
5
votes
3 answers

Rack::Lint::LintError: Status must be >=100 seen as integer

I am using the DataMapper gem with Sinatra and followed the tutorial here: http://net.tutsplus.com/tutorials/ruby/ruby-for-newbies-working-with-datamapper/ I am connecting to the database and migrating as such: DataMapper.setup :default,…
etayluz
  • 14,171
  • 16
  • 86
  • 132