h3. When NOT to use ActiveRecord

h4. AR has some limit

* One class per table
* Primary key has to be id
* no composite primary keys
* Foreign keys are table_name_id

h4. iBatis as a datamapper – a different mapper for data -> objects

It uses the “DataMapper” pattern

h3. RBatis

* ruby implimention of iBatis
* written by “Jon Tirsen”:jutopia.tirsen.com
* less then 500 lines of code
* 3 files
* “rbatis”:https://svn/apache.org/repos/asf/ibatis/trunk

built around the data mapper pattern
a statement understands executable sql
a resultmap understands a translation from a recordset to a model

h3. Rails integration

it’s a mix-in repos like behavior to a model

class Product < RBatis::Base
attr_reader :product_id
resultmatp :default,
:product_id => [

What about updating methods? They are added by RBatis – things like .save .delete

It DOES Support active record validations!

Average Rating: 4.4 out of 5 based on 220 user reviews.