On Fri, Jul 11, 2008 at 4:06 PM, Bashar Abdul
<[EMAIL PROTECTED]> wrote:
> class Person {
>     String name
>     def hasMany = [articles:Article]
> }
>
> You can use Hibernate's Criteria Builder:
>
> def c = Person.createCriteria()
> def results = c.list{
>     articles{
>         like('content','Paris Hilton')
>     }
> }

OK.  If I understand, "def c" would be "def
articles_about_paris_hilton"?  This is still not as nice as
ActiveRecord, I think.  You are having to create custom helper methods
directly on the Model.  For example, bob.articles_about_paris_hilton
vs the (more OO and messagey) bob.articles.about_paris_hilton which
leverages the (nicely decoupled and Demeterish)
Article.about_paris_hilton?

However, Brian's points about the maturity and stability of Hibernate
vs. ActiveRecord are well taken.  I think it all depends on your
project.  For Agile startup social networking projects, the
flexibility, readability, and speed of ActiveRecord trumps.  For a
project where you really care about database integrity or ACID, you
would probably want to think about using some DSL on top of hibernate,
like GORM.  I still think the GORM syntax looks like poop compared to
Ruby and ActiveRecord, though :)

-- Chad

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to