On 13/01/10 6:53 PM, Andrus Adamchik wrote:
> Essentially the pipe symbol can only be used with 'matchAllExp'. This is
> a special case, and I am not sure it makes sense in a general case.
> General case is handled a bit differently via "path aliases". I.e. for
> each group of paths that you want to be executed as a single join, you
> create a single alias. Different aliases over matching paths generate
> separate joins.
Would it make sense to incorporate this idea into the new typesafe Expression syntax planned for 3.1? That is, you might combine expressions with:
exp1.and(exp2, Expression.SPLIT_PATH)
exp1.and(exp2, Expression.MERGE_PATH)
exp1.and(exp2)
The last would equivalent to Expression.SPLIT_PATH since I'd argue that gives you the most intuitively meaningful results if the path is joined to-many.
How do you use the aliases approach? The docs are a bit light in that area.
Expression e1 = ExpressionFactory.like("paintings.gallery.name", "foo");
Expression e2 = ExpressionFactory.like("paintings.gallery.name", "bar");
Expression e = e1.andExp(e2);
q = new SelectQuery(Artist.class, e);
q.aliasPathSplits("paintings.gallery","paintings.gallery");
In this example, can the alias and the path have the same name (this means we don't need to change all the expressions)? In any case, for us this is going to be complicated because the expressions are created in one place long way away (in code) from where the SelectQuery is created. So we might have to subclass Expression in order to carry the extra information about aliases.
Ari
-- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
This archive was generated by hypermail 2.0.0 : Wed Jan 13 2010 - 04:22:50 EST