datamapper

Mule - Pass Parameters to datamapper and access them in xpath conditions

随声附和 提交于 2019-12-04 06:55:31
问题 How to pass parameters to datamapper in mule and access them. (In XSLT, I pass them as context parameters, receive them in param and access using $ symbol). I need to do the same thing in datamapper. Any suggestions/links/example are appreciated. Approach1: We are using invokeTransformer method in datamapper output.abc= invokeTransformer("MyTransformer",input.abcdef); This MyTransformer is a java component which has this default method overridden. @Override public String transformMessage

Datamapper: Sorting results through association

半腔热情 提交于 2019-12-04 06:07:20
I'm working on a Rails 3.2 app that uses Datamapper as its ORM. I'm looking for a way to sort a result set by an attribute of the associated model. Specifically I have the following models: class Vehicle include DataMapper::Resource belongs_to :user end class User include DataMapper::Resource has n, :vehicles end Now I want to be able to query the vehicles and sort them by the name of the driver. I tried the following but neither seems to work with Datamapper: > Vehicle.all( :order => 'users.name' ) ArgumentError: +options[:order]+ entry "users.name" does not map to a property in Vehicle >

Is Datamapper's dm_mysql_adapter gem supported on windows?

拜拜、爱过 提交于 2019-12-04 02:19:39
问题 I am wanting to play some more with Ruby and currently seem to have a grasp of sinatra, but would also like to now pull in data from a relational database. I tend to use Mysql for test apps and tried installing the gems but I keep getting an exception when it tries to compile the native do_mysql gem which it is reliant upon. I do have the native extensions installed and they worked fine for the JSON gem, I remember reading somewhere a while back that the do_mysql wasnt supported for windows

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

谁说胖子不能爱 提交于 2019-12-03 11:08:46
问题 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 following (or equivalent) on ActiveRecord and Sequel on table with lots of rows: posts.each { |p| puts p } Both of them go crazy on memory. They seem to load everything in memory rather than fetching stuff when needed. I used the find_in_batches in

Sinatra + Heroku + Datamapper deploy issues with dm-sqlite-adapter

强颜欢笑 提交于 2019-12-03 08:18:40
For some reason, heroku tries to require dm-sqlite-adapter, even though it should use Postgres here. Note, that this happens when I open any URL - not during the git push itself. I built a default facebook app. The Gemfile: source :gemcutter gem "foreman" gem "sinatra" gem "mogli" gem "json" gem "httparty" gem "thin" gem "data_mapper" gem "heroku" group :production do gem "pg" gem "dm-postgres-adapter" end group :development, :test do gem "sqlite3" gem "dm-sqlite-adapter" end Datamapper setup: # Setting up the database DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}

Data Mapper Pattern: Complexe query from Service Layer

主宰稳场 提交于 2019-12-03 07:24:18
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 AUTO_INCREMENT, `name` varchar(50) NOT NULL, `age` int(3) NOT NULL, `haircolor` varchar(20) DEFAULT NULL, PRIMARY KEY (`id``), ); Now I try to select all people, that have brown hair. I use the following method in the ServiceLayer public function getPeopleByHaircolor($hair) { return $this->getMapper()->fetch('haircolor = ?', $hair); } The method in

Data Mapper Pattern

眉间皱痕 提交于 2019-12-03 06:57:50
问题 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 pattern, but my knowledge of this pattern is still very limited. Let's use the following example: If I have 2 tables - Customer and CustomerParameters. The CustomerParameters table contains default Customer values for creating a new Customer. I will then

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

不羁的心 提交于 2019-12-03 06:55:36
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 one-to-one match of domain classes to tables starts to fail as you factor domain logic into smaller classes. Relational databases don't handle inheritance, so it becomes difficult to use strategies [Gang of Four] and other neat OO patterns. As the domain logic gets feisty, you want to be able to test it without having to talk to the database all the

Is Data Mapper a more modern trend than Active Record

谁说胖子不能爱 提交于 2019-12-03 06:06:53
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 than Active Record? Was it around when the Active Record movement started? How do the two relate together? Lastly since I'm not a database person and know little about this subject, should I follow an ORM that's moving to the Data Mapper implementation, as in what's in it for me as someone writing software (not a data person)? Gordon The DataMapper

Automatic logging of DataMapper queries

风流意气都作罢 提交于 2019-12-02 22:44:27
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 file that loads when the app is started. I have also tried: DataMapper::Logger.new('log/my-app.log', :debug) Neither yields log statements from the app accessed either through a browser or through an irb session that requires my app. I do see the app starting message. I am using rackup config.ru to run the app locally. What am I missing? It seems that