Wednesday, January 17, 2007

Of ActiveRecord/GORM and DAO Patterns

Emmanuel Bernard of the Hibernate team has an interesting post about his dislike for the ActiveRecord pattern which Grails' ORM tech GORM uses. The interesting thing here is that he points to EJB1/2 as an example of the failure of this pattern.

My personal view here is that EJB1/2 failed because it was god awful, not because it used the ActiveRecord pattern. It was configuration heavy, tied you to the technology by being totally obtrusive, and forced you to think about ORM too much. These are the reasons for its failure.

As far as ActiveRecord from Rails and GORM from Grails go the nice thing about these is how remarkable simple they are to use with zero configuration. This is the power and benefit they offer.

Also you can think in an entirely abstract way about the underlying persistence mechanism. For example with GORM at the moment it is backed by Hibernate, but in the future we plan to implement support for JPA and even possibly support for using GORM ontop of Tangasol Coherence or Terracotta so you can use Grails on top of a data grid solution for massively scalable applications.

With GORM not forcing you to extend any base class and being totally unobtrusive this is all possible. The reality is Java frameworks force you to have a DAO layer, its not out of choice that they exist. Still this is not an insurmountable problem, I'm surprised there aren't more AOP based solutions around. In the meantime GORM is solving real problems.

10 comments:

Anonymous said...

Terracotta and data grid support sounds fascinating. It is that kind of functionallity that can be the tipping point for Grails in favour of Rails.

polesen said...

You write about "the failure of EJB1/2". While I now also dislike EJB2 when compared to ORM mapping tools like JPA/Hibernate, EJB1/2 has not failed. It has been very popular in many enterprise applications. It is being used and it works. It's got issues, yes, but if you look at the history it has not failed. Technology simply develops as time goes...

Steven said...

If you're going to count the number of occurances to decide if something is popular than paying taxes is very popular.

Seriously, EJB 2 has been frequently used because at the time it was the only offering that offloaded developers from having to deal with transaction management. Second most used feature is message driven beans.

Since all these features are now being offered in much more friendly and more productive ways EJB penetration (not re-iteration) is in sharp decline.

Anonymous said...

I definately agree that for Grails the ActiveRecord pattern as done by GROM is much better and more KISS.

To me it is just more direct and less complex and the main disadvantage not having POJOs goes also away.

What I don't like that much is that GORM is implemented on top of Hibernate. Hibernate is complex and having something on top of it does not make it easier to understand what is realy going on. Maybe a future version of GORM could use a java framework which itself is ActiveRecord based, like carbonado or something similar.

George said...

What about supporting iBatis?

Cameron said...

Graeme - I'll be at JavaOne. If you are around, stop by and say hi, and we could talk about this some more.

Peace.

derfefww said...

It is the 2moons dil which make me very happy these days, my brother says 2moons gold is his favorite games gold he likes, he usually buy some 2moon dil to start his game and most of the time he will win the buy 2moons dil back and give me some cheap 2moons gold to play the game.

Anonymous said...

網頁設計,情趣用品店,情趣用品專賣網

A片,色情A片,免費A片,成人影片,色情影片,a片免費看,情色貼圖,情色文學,情色小說,色情小說
AV,AV女優

辣妹視訊,美女視訊,視訊交友網,視訊聊天室,視訊交友,視訊美女,免費視訊,免費視訊聊天,視訊交友90739,免費視訊聊天室,成人聊天室,視訊聊天,視訊交友aooyy
哈啦聊天室,辣妺視訊,A片,色情A片,視訊,080視訊聊天室,視訊美女34c,視訊情人高雄網,視訊交友高雄網,0204貼圖區,sex520免費影片,情色貼圖,視訊ukiss

Anonymous said...

In order to play the Cabal, I already forget I spend how much money to buy the cabal alz, in my memory, every time to buy cabal alz, I always want to search sell the cheap cabal alz website, but every time I always failed, so if has someone know the cheapest cabal gold, I hope can told me.

Anonymous said...

^^ nice blog!! ^@^

徵信, 徵信網, 徵信社, 徵信社, 感情挽回, 婚姻挽回, 挽回婚姻, 挽回感情, 徵信, 徵信社, 徵信, 徵信, 捉姦, 徵信公司, 通姦, 通姦罪, 抓姦, 抓猴, 捉猴, 捉姦, 監聽, 調查跟蹤, 反跟蹤, 外遇問題, 徵信, 捉姦, 女人徵信, 女子徵信, 外遇問題, 女子徵信, 外遇, 徵信公司, 徵信網, 外遇蒐證, 抓姦, 抓猴, 捉猴, 調查跟蹤, 反跟蹤, 感情挽回, 挽回感情, 婚姻挽回, 挽回婚姻, 外遇沖開, 抓姦, 女子徵信, 外遇蒐證, 外遇, 通姦, 通姦罪, 贍養費, 徵信, 徵信社, 抓姦, 徵信, 徵信公司, 徵信社, 徵信公司, 徵信社, 徵信公司, 女人徵信,

徵信, 徵信網, 徵信社, 徵信網, 外遇, 徵信, 徵信社, 抓姦, 徵信, 女人徵信, 徵信社, 女人徵信社, 外遇, 抓姦, 徵信公司, 徵信社, 徵信社, 徵信社, 徵信社, 徵信社, 女人徵信社, 徵信社, 徵信, 徵信社, 徵信, 女子徵信社, 女子徵信社, 女子徵信社, 女子徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信社,

徵信, 徵信社,徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 外遇, 抓姦, 離婚, 外遇,離婚,

徵信社,徵信, 徵信社, 徵信, 徵信社, 徵信,徵信社, 徵信社, 徵信, 外遇, 抓姦, 徵信, 徵信社, 徵信, 徵信社, 徵信, 徵信社, 徵信社, 徵信社, 徵信社,徵信,徵信, 徵信, 外遇, 抓姦