Monday, May 19, 2008

rbatis patch for custom (non default) resultmaps

I had to use the following patch to make custom resultmaps (i.e. non :default resultmaps) work with rbatis:

vendor/plugins/rbatis/lib/rbatis.rb (line 406)
def statement(statement_type, name = statement_type, params = {}, &proc)
...
statement.connection_provider = self
if statement.respond_to?(:resultmap=) && statement.resultmap.nil?
statement.resultmap = resultmaps[:default]
else
statement.resultmap = resultmaps[statement.resultmap]
end
statement.validate
...
end
rbatis is pretty slick, especially when you have to work with legacy databases and schemas.

No comments: