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

What do you think is the best approach for creating a data mapping layer in python?

I would appreciate hearing some opinions on the best approach to creating a light-weight data mapping layer between some python objects and a postgres database. I'm using the psycopg2 library, and plan to use pgbouncer. I looked at this:…
Jaigus
  • 1,130
  • 1
  • 14
  • 28
0
votes
1 answer

Datamapper two associations at the same time

Lets say I have a post, this post should have a certian amount of comments, and these comments should be created by certian users. So these are my datamapper models: class User include DataMapper::Resource property :id, Serial property :name,…
Micheal Perr
  • 1,425
  • 5
  • 14
  • 23
0
votes
1 answer

Error installing datamapper gem on lion

I am trying to install the datamapper gem on mac os x lion but am getting failed to build gem native extension while installing the sqlite adapter (see terminal output below). The two solutions I found from google and other stack overflow questions…
Ben
  • 557
  • 2
  • 10
  • 23
0
votes
1 answer

Minimum length for a String property in DataMapper

Im using DataMapper in my Sinatra application.I defined a property called 'to' whose minimum length i want to be 10 property :to,String,:required => true,:min => 10 This causes my application to crash with the error assert_valid_options':…
Kris
  • 1,313
  • 3
  • 16
  • 26
0
votes
2 answers

Creating multiple models

I'm using Zend Framework and implementing Domain Model. I have Models, Mappers and DbTables. Suppose we should fetch multiple rows from database or fetch form data where we should create multiple models and populate that models from database rows or…
Tigran Tokmajyan
  • 1,857
  • 6
  • 24
  • 36
0
votes
1 answer

DataMapper has_one problem

I`m having trouble associating models in DataMapper. Its really simple, but i just can get the idea. So, i have 2 tables: 1. Books -> id -> title -> publisher_id 2. Publishers -> id -> title The classes: class Book property :id, Serial …
Joe
0
votes
1 answer

undefined method `include?' for nil:NilClass

I have a Sinatra application running on Ubuntu / Apache2 / Passenger. It's a simple URL shortener that works on my staging server but started throwing the following error when I imported the old database (containing shortened URLS): undefined method…
Matt Gifford
  • 1,210
  • 8
  • 13
0
votes
1 answer

string to object?

Consider the following code: I receive an object from datamapper which contains Values from my select: user = User.first() puts user.name # John puts user.surname # Doe puts user.age # 42 In a user defined Array I have an Order for these Values to…
witsches
  • 227
  • 2
  • 3
  • 7
0
votes
1 answer

getting difficulty in generating the Dyanmic checkbox from the database

I am using Codeigniter and Datamapper for DB Query. My controller is as follows function fetch_interested_in() { $in = new Interested_in(); $in -> get(); $interested_in = array(); foreach($in -> all as $data) { …
Shashi Roy
  • 303
  • 3
  • 7
  • 21
0
votes
1 answer

Selecting Item from Android Spinner and Using It

I have a spinner which is populated from an Enum: public enum Frequencies { EVERYDAY("Every day"), EVERYOTHERDAY("Every second day"); private String friendlyName; private Frequencies(String friendlyName) { …
barry
  • 3,741
  • 4
  • 36
  • 65
0
votes
1 answer

Graphical Data Mapping for Eclipse

I´m looking for an open source graphical data mapper for Java/Eclipse that can map between POJOs. Something similar to Mapforce, Mule Studio's data mapper component or Dozer (but visual). Regards.
Víctor Romero
  • 4,997
  • 1
  • 19
  • 31
0
votes
1 answer

DataMapper all_to_json() method returning slashes

I just found DataMapper for CI's built in to_json and all_to_json methods, which saved me a ton of time. How can I return relations with the result? Currently my code looks like this: $homes = new…
Seth
  • 6,090
  • 3
  • 25
  • 42
0
votes
2 answers

merb cannot load dm-mysql-adapter

Would you help me on this issue? gem list shows that dm-mysql-adapter has been installed, but merb cannot load it. I just want to start a simple merb application generated by merb-gen. Loading init file from ./config/init.rb Loading…
Hardbone
  • 327
  • 1
  • 3
  • 16
0
votes
2 answers

Testing Datamapper models with RSpec

I'm testing a Sinatra application, which is using DataMapper, with RSpec. The following code: it "should update the item's title" do lambda do post "/hello/edit", :params => { :title => 'goodbye', :body => 'goodbye world' } …
Samy Dindane
  • 15,488
  • 3
  • 36
  • 49
0
votes
1 answer

DataMapper Self Relation Model

Hi I am using CodeIgniter with DataMapper and really need some help defining relationship in a model class (DataMapper Model Class) How would I write the model relation for this. Slightly confused about the Self relation, i.e menu item and sub…
ebsol
  • 3
  • 4