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
0
votes
1 answer

DataMapper: tag to key relationship?

I'm using the DataMapper component in MuleStudio. I want to transform data that I have in this format login.01 to something like this
Narabhut
  • 839
  • 4
  • 13
  • 30
0
votes
0 answers

DataMapper Adapter for MS SqlServer

I am new to Ruby on Rails. I am planning to use SQLServer as the database for my application. For ORM, i did some searching and it is recommended to use DataMapper over ActiveRecords. But i cannot find any adapter from DataMapper to use with…
Vinoth
  • 2,419
  • 2
  • 19
  • 34
0
votes
0 answers

Where/when to implement some COUNT() statements in my MVC application

Ok so I have my CustomerMapper mapping my Customer domain object perfectly but today I was in the middle of some business logic in one of my domain objects which uses my Customer object and I realized I needed to have some sort of if(…
ibanore
  • 1,500
  • 1
  • 12
  • 25
0
votes
2 answers

Data mapper - count objects uploaded on specific date

I am building a simple app and I want to show some simple statistics to admins. I want to know is it possible to get the array of counts of objects from database that were created on the same date using datamapper or do I have to manually go through…
0
votes
2 answers

Ruby DataMapper: How can I do pagination?

I am going to retrieve a list of objects. get "/todoitems/?" do debugger todo = Todolist.all todo.to_json end Is there example that can retrieve page by page? Many thanks.
TheOneTeam
  • 25,806
  • 45
  • 116
  • 158
0
votes
1 answer

undefined method merge

merb datamapper seems to be broken. $ merb Loading init file from /home/kristian/workspace/ruby/nightly/config/init.rb Loading /home/kristian/workspace/ruby/nightly/config/environments/development.rb :size option is deprecated, use String with…
kristian nissen
  • 2,809
  • 5
  • 44
  • 68
0
votes
1 answer

Laravel 4 with Data Mapper?

Does anyone know if Laravel has some sort of library/plugin or tweak to use Data Mapper or to make Active Record behave like Data Mapper?. I'm not a Laravel user,so perhaps Eloquent is using a mix of Active Record and Data Mapper and I'm not aware…
AZReed
  • 103
  • 1
  • 9
0
votes
2 answers

MyBatis - Mapper vs DAO

I am trying to get this answered, and found one comment in the MyBatis documentation: Usually MapperFactoryBean is preferred to this class, since it requires no extra code. But, this class(DAO) is useful if you need to do other non-MyBatis work…
Sandeep Jindal
  • 14,510
  • 18
  • 83
  • 121
0
votes
1 answer

DataMapper behaving differently when Rails app is run as console and server

I have a Rails 3.1 app and I use DataMapper as ORM. I have following models (stripped): class Task include DataMapper::Resource belongs_to :group def project group && group.project end end class Group include DataMapper::Resource …
mspanc
  • 550
  • 5
  • 15
0
votes
1 answer

Reducing service config duplication with a custom service locator?

My app uses the data mapper pattern, so I have a number of mapper classes, which each needs an instance of the database adapter. So the factories section of my service config is filled with entries like this: 'UserMapper' => function($sm) { …
Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
0
votes
1 answer

Ruby/DataMapper: Problems with multiple many-to-many associations

I have implemented models for User-Group relationship, where one User can be a member and owner of one or more Groups and where one Group can have one or more owners and one or more members. Now, the problem is User.owned_groups returns only 1 Group…
draxxxeus
  • 1,503
  • 1
  • 11
  • 14
0
votes
1 answer

Using data mapper inside another data mapper in Java?

I'm using the data mapper pattern in Java for accessing the database. Is it OK to call a mapper inside of another mapper? As far as I'm concerned, mappers should work on their own without a dependency on other mappers, but it seems that someone else…
ZimZim
  • 3,291
  • 10
  • 49
  • 67
0
votes
0 answers

Datamapper does not save/update entry

I'm currently developing a quick little sinatra app, and I've managed to conquer authentication quite easily. However I cannot for the life of me get password changing to work. I'm using the code below with Datamapper, and although it reaches the…
Simon M
  • 15
  • 3
0
votes
1 answer

data_mapper find number of rows

I can't find an answer for this elsewhere, so I'm asking here: How do I "SELECT COUNT" with data_mapper? What I've tried: MyClass.count MyClass.size MyClass.all.count MyClass.all.size What does work is: ids = [] MyClass.all.each do |class| ids…
Alfo
  • 4,801
  • 9
  • 38
  • 51
0
votes
2 answers

Get associated records with Datamapper using Sinatra

I am currently working on a small backend, managing events with associated locations. Unfortunately, it's my first time i work with Ruby/Sinatra/Datamapper. After 3 hours trying to find a solution, i have to write this post. I have defined two…
ehlers
  • 690
  • 6
  • 9