Forum: Ruby Hibernate on Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-12 22:49
(Received via mailing list)
Any ideas on using Hibernate OR/M from within Ruby?
45196398e9685000d195ec626d477f0e?d=identicon&s=25 Trans (Guest)
on 2005-12-12 22:52
(Received via mailing list)
Why, when you have Og, ActiveRecord and a few other interesting
choices?

T.
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-12 22:58
(Received via mailing list)
ActiveRecord is great for small-to-medium things, but does quickly show
it's limits on large things.  NOTE: Please, do not turn this thread
into a flame war.  See Martin Fowler's discussion of ActiveRecord
versus DataMapper.  Rails's ActiveRecord is based on Fowler's
ActiveRecord pattern, wheras Hibernate is a DataMapper, which Fowler
himself favors for complicated mappings.

See DHH's post:
"No, you don't get the full offer of opportunities that straight OO
with a data mapper holds. I'd like to think, though, that Active Record
gives you 80% of the features for 20% of the effort."
http://www.loudthinking.com/arc/000209.html

Example for me:
Let's say I have a class hierarchy, in which a particular field is
stored direclty in the db for one class, and calculated using a simple
SQL formula for other other classes.  How can I use the DB to query the
tree for all objects where field == aVal.

Answer: In ActiveRecord - you can't (w/o major hacking).  You need to
instantiate each one from the db, and then use Ruby to check each one.
Fe9b2d0628c0943af374b2fe5b320a82?d=identicon&s=25 Eero Saynatkari (rue)
on 2005-12-12 23:54
List Recv wrote:
> ActiveRecord is great for small-to-medium things, but does quickly show
> it's limits on large things.  NOTE: Please, do not turn this thread
> into a flame war.  See Martin Fowler's discussion of ActiveRecord
> versus DataMapper.  Rails's ActiveRecord is based on Fowler's
> ActiveRecord pattern, wheras Hibernate is a DataMapper, which Fowler
> himself favors for complicated mappings.
>
> See DHH's post:
> "No, you don't get the full offer of opportunities that straight OO
> with a data mapper holds. I'd like to think, though, that Active Record
> gives you 80% of the features for 20% of the effort."
> http://www.loudthinking.com/arc/000209.html
>
> Example for me:
> Let's say I have a class hierarchy, in which a particular field is
> stored direclty in the db for one class, and calculated using a simple
> SQL formula for other other classes.  How can I use the DB to query the
> tree for all objects where field == aVal.
>
> Answer: In ActiveRecord - you can't (w/o major hacking).  You need to
> instantiate each one from the db, and then use Ruby to check each one.

Google up Og and Kansas and see if either suits you better.
Both take a modeling approach perpendicular to AR. There
are others also, I am sure.

Or, of course, you could restructure your data :)


E
8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed A. Shaw (Guest)
on 2005-12-13 02:41
(Received via mailing list)
On Tue, 13 Dec 2005 07:55:02 +0900
Eero Saynatkari <ruby-forum-reg@mailinator.com> wrote:

>
> Google up Og and Kansas and see if either suits you better.
> Both take a modeling approach perpendicular to AR. There
> are others also, I am sure.
>
> Or, of course, you could restructure your data :)

No, that'd actually involve admitting he is wrong.  The day a
programmer actually admits he's wrong is the day Satan ice skates
around Times Square in July eating Tasti-Delight while wearing long
underwear.

For another great example of "fighting to always be right" refer to any
thread about plural table names (either side).

Zed A. Shaw
http://www.zedshaw.com/
3c155ef399326d533efc2eb91ac992e5?d=identicon&s=25 Neil Stevens (Guest)
on 2005-12-13 02:50
(Received via mailing list)
Zed A. Shaw wrote:
> No, that'd actually involve admitting he is wrong.  The day a
> programmer actually admits he's wrong is the day Satan ice skates
> around Times Square in July eating Tasti-Delight while wearing long
> underwear.

Yeah, that's the way, go off on a tangent and berate someone for asking
a simple question, without actually giving him a straight answer.

Now I remember why I unsubscribed from this group before...

--
Neil Stevens - neil@hakubi.us

'A republic, if you can keep it.' -- Benjamin Franklin
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-13 04:38
(Received via mailing list)
Thanks for the support Neil.
32edd0717b3144d5c58a352d613abdc9?d=identicon&s=25 gabriele renzi (Guest)
on 2005-12-13 11:03
(Received via mailing list)
listrecv@gmail.com ha scritto:
> Any ideas on using Hibernate OR/M from within Ruby?
>


probably the only chance is using jruby, but are you sure you can't do
what you want with Og ?
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2005-12-13 15:34
(Received via mailing list)
On 12/12/05, listrecv@gmail.com <listrecv@gmail.com> wrote:
> Thanks for the support Neil.
>
I won't claim to support this idea. Personally, I think it's like
having your whole BMW chromed. Heh.

However, you should be able to actually do it with something like:
http://rjni.rubyforge.org/
..or:
http://raa.ruby-lang.org/project/rjb/

I'm not sure if there's a good way to gen the XDoclet tags in Ruby.
Presumably there's a fancy ERb trick you can use.
This topic is locked and can not be replied to.