You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2008/04/30 14:12:40 UTC
Join splits
Now looking to add splits to SelectQueries, I am wondering if the
approach we discussed before is too "special case". To reiterate, the
idea of a "join split" (CAY-802), was to allow users to override the
default behavior of Cayenne which is to reuse all joins. Here is some
in-depth discussion of useful split scenarios:
http://objectstyle.org/cayenne/lists/cayenne-devel/2003/09/0096.html
I am wading through archives trying to find the pipe ("|") semantics
that Giulio Cesare used for the splits, but IIRC it was something like
this:
rel1.rel2|rel3.rel4
That's fine except that it is targeting a special case of matching a
single path against a collection of values. A more generic case would
be multiple overlapping but different expression paths. E.g.:
rel1.rel2.rel3.rel4
rel1.rel2.rel3.rel5
Split semantics, while rather concise and clear for its intended use,
doesn't help us in dealing with multiple overlapping paths... So how
do we handle those? One possible solution is to follow EJBQL idea and
define aliases for join paths. This way each alias for the same path
generates a separate chain of joins that can be reused if needed. E.g.:
SelectQuery query = ...
query.addQualifierAlias("rel1.rel2", "a");
query.addQualifierAlias("rel1.rel2", "b");
Then the following can be used as qualifier:
a.x
a.rel4
b.y
b.rel5
Any thoughts on that? Would that be better than the pipe sign? (and
did we discuss that before, and I am simply missing it)
Andrus
Re: Join splits
Posted by Mike Kienenberger <mk...@gmail.com>.
Aliases seem like a good idea. I know that when I implemented all of
this, internally I had to set up an alias table, so it's a natural
fit.
On 4/30/08, Andrus Adamchik <an...@objectstyle.org> wrote:
> Now looking to add splits to SelectQueries, I am wondering if the approach
> we discussed before is too "special case". To reiterate, the idea of a "join
> split" (CAY-802), was to allow users to override the default behavior of
> Cayenne which is to reuse all joins. Here is some in-depth discussion of
> useful split scenarios:
>
>
> http://objectstyle.org/cayenne/lists/cayenne-devel/2003/09/0096.html
>
> I am wading through archives trying to find the pipe ("|") semantics that
> Giulio Cesare used for the splits, but IIRC it was something like this:
>
> rel1.rel2|rel3.rel4
>
> That's fine except that it is targeting a special case of matching a single
> path against a collection of values. A more generic case would be multiple
> overlapping but different expression paths. E.g.:
>
> rel1.rel2.rel3.rel4
> rel1.rel2.rel3.rel5
>
> Split semantics, while rather concise and clear for its intended use,
> doesn't help us in dealing with multiple overlapping paths... So how do we
> handle those? One possible solution is to follow EJBQL idea and define
> aliases for join paths. This way each alias for the same path generates a
> separate chain of joins that can be reused if needed. E.g.:
>
> SelectQuery query = ...
> query.addQualifierAlias("rel1.rel2", "a");
> query.addQualifierAlias("rel1.rel2", "b");
>
> Then the following can be used as qualifier:
>
> a.x
> a.rel4
> b.y
> b.rel5
>
> Any thoughts on that? Would that be better than the pipe sign? (and did we
> discuss that before, and I am simply missing it)
>
> Andrus
>
>