On Sun, Jul 18, 2010 at 9:00 PM, David Ihnen <[email protected]> wrote:

> On Sun, Jul 18, 2010 at 1:39 PM, Leandro Hermida <
> [email protected]> wrote:
>
>> On Sun, Jul 18, 2010 at 7:49 PM, Peter Rabbitson 
>> <[email protected]<rabbit%[email protected]>
>> > wrote:
>>
>>> On Sun, Jul 18, 2010 at 02:40:47PM +0200, Leandro Hermida wrote:
>>> > very good points and makes a lot of sense.  If I can ask a more general
>>> > question then, why do ORMs exist in the first place and why are they so
>>> > popular vs using a object persistence mechanism?  There must be some
>>> serious
>>> > advantage to using them.
>>> >
>>>
>>> Because there yet does not exist a persistent object store, that can be
>>> asked to fetch "all objects which have related objects whose attribute X
>>> is Y", and which will do so by *transparrently* using native SQL methods
>>> (namely GROUP BY over a joined resultset). Matt Trout is working on the
>>> foundation of just such a "mapper", but this is a very very hard problem
>>> to get right, so progress is slow.
>>>
>>
>> I know this might sound sacrilegious, but established frameworks like
>> Hibernate have solved this problem and the code is freely available, I think
>> it would be easier to see how such complex ORM details are done there as a
>> starting point and then go from there other than starting from completely
>> scratch?
>>
>
> I'm confused, are you saying that Hibernate can be asked to fetch all
> objects which have related objects who attribute X is Y and it solves this
> problem by transparently using native SQL methods (like GROUP BY over a
> joined resultset)?
>
> Or are you saying that Hibernate can fetch all objects using some other
> method of query and retrieval?
>
>
Hi, very sorry... I was speaking more in general about writing an OO-centric
ORM and that it is difficult topic but that there are very well established
open-source solutions like Hibernate and others in the space that one could
draw inspiration or ideas from to build a Perl Moose/OO-centric ORM.  Why
not look at how others have solved such technical issues?

About the querying question, Hibernate and JPA (which I mentioned earlier)
have their own query languages HQL and JPQL which somewhat resemble SQL but
work with objects.  I would imagine a Moose-based DBIC would have one as
well?  If you use HQL I believe you can actually make a query that fetches
all objects who's related object's attribute X is Y, see here
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html.  I
believe it translates HQL into SQL before making the query in a transparent
way.
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to