You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Arturo P�rez <ap...@hayesinc.com> on 2006/10/13 05:58:59 UTC

How to use RelationshipQuery?

Hi all,

I was trying to populate some Click CayenneForm things.  Coming from an 
EOF world, I prefer to traverse relationships rather than run queries.  
But many (all?) of the Click Cayenne integrations require SelectQuery to 
function.  In looking around for a way to bridge this divide, I stumbled 
across the RelationshipQuery thing in Cayenne 1.2.  But I couldn't 
figure out how to use it.  What's an EntityResolver?  How do I get one?  
How do I convert a RelationshipQuery into a SelectQuery?  Is this even a 
sensible way to approach the problem?

An example use of the RelationshipQuery or a better suggestion would be
much appreciated,

tia,
arturo


Re: How to use RelationshipQuery?

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Arturo,

Not quite sure what problem you are trying to solve, but I can  
comment on RelationshipQuery. RelationshipQuery is used by Cayenne  
internally to resolve relationships. Applications rarely create it  
directly, but there is no problem if you do:

http://cwiki.apache.org/CAYDOC/relationshipquery.html

Ignore the EntityResolver methods, as those are just callbacks that  
are invoked by Cayenne when the query is executed. Just for the  
reference, EntityResolver is a logical analog of EOF EOModelGroup -  
it provides a single combined namespace for mapping metadata and is  
accessible via ObjectContext|DataContext.getEntityResolver().

Andrus


On Oct 12, 2006, at 11:58 PM, Arturo Pérez wrote:
> Hi all,
>
> I was trying to populate some Click CayenneForm things.  Coming  
> from an
> EOF world, I prefer to traverse relationships rather than run queries.
> But many (all?) of the Click Cayenne integrations require  
> SelectQuery to
> function.  In looking around for a way to bridge this divide, I  
> stumbled
> across the RelationshipQuery thing in Cayenne 1.2.  But I couldn't
> figure out how to use it.  What's an EntityResolver?  How do I get  
> one?
> How do I convert a RelationshipQuery into a SelectQuery?  Is this  
> even a
> sensible way to approach the problem?
>
> An example use of the RelationshipQuery or a better suggestion  
> would be
> much appreciated,
>
> tia,
> arturo
>
>