FAQ
Hi all.

I find that when I query over relationships I (and my users) almost always want an outer join. For example, if I ask for a list of Employee objects based on the expression ((name=’McDonald’) or (employee.company.name=‘McDonald’)), I don’t want to exclude employees named “McDonald" that don’t have an associated company record. The part of the query that involves the company is separated from the first part by a logical “or” and thus the user will always believe that it should not affect results of other parts of the expression. Checking for employees without a company feels like a third condition that should be explicitly stated.

I know I can call “outer()” on a property every time I’m constructing paths to query on, however, that gets old fast (and easy to forget), so currently I’m doing string replace in my paths, replacing “.” with “+.”. That makes me feel dirty.

So, I ask: Is there any way for me to ask Cayenne to implicitly perform outer joins when filtering on expressions, unless explicitly otherwise stated? For example, when modeling relationships? (as is done in EOF)

Cheers,
- hugi

// Hugi Thordarson
// http://www.loftfar.is/ <http://www.loftfar.is/>
// s. 895-6688

Search Discussions

  • Andrus Adamchik at Aug 28, 2015 at 6:45 am
    No, that's a decision you'd make when building an expression (like you do).

    We actually initially thought of adding join semantics to relationships in the model, but that felt misplaced, so it ended up where it is now.

    Andrus

    On Aug 27, 2015, at 6:37 PM, Hugi Thordarson wrote:

    Hi all.

    I find that when I query over relationships I (and my users) almost always want an outer join. For example, if I ask for a list of Employee objects based on the expression ((name=’McDonald’) or (employee.company.name=‘McDonald’)), I don’t want to exclude employees named “McDonald" that don’t have an associated company record. The part of the query that involves the company is separated from the first part by a logical “or” and thus the user will always believe that it should not affect results of other parts of the expression. Checking for employees without a company feels like a third condition that should be explicitly stated.

    I know I can call “outer()” on a property every time I’m constructing paths to query on, however, that gets old fast (and easy to forget), so currently I’m doing string replace in my paths, replacing “.” with “+.”. That makes me feel dirty.

    So, I ask: Is there any way for me to ask Cayenne to implicitly perform outer joins when filtering on expressions, unless explicitly otherwise stated? For example, when modeling relationships? (as is done in EOF)

    Cheers,
    - hugi

    // Hugi Thordarson
    // http://www.loftfar.is/ <http://www.loftfar.is/>
    // s. 895-6688

  • Hugi Thordarson at Aug 28, 2015 at 7:16 am
    Okay, thanks!

    - hugi


    On 28. ágú. 2015, at 06:44, Andrus Adamchik wrote:

    No, that's a decision you'd make when building an expression (like you do).

    We actually initially thought of adding join semantics to relationships in the model, but that felt misplaced, so it ended up where it is now.

    Andrus

    On Aug 27, 2015, at 6:37 PM, Hugi Thordarson wrote:

    Hi all.

    I find that when I query over relationships I (and my users) almost always want an outer join. For example, if I ask for a list of Employee objects based on the expression ((name=’McDonald’) or (employee.company.name=‘McDonald’)), I don’t want to exclude employees named “McDonald" that don’t have an associated company record. The part of the query that involves the company is separated from the first part by a logical “or” and thus the user will always believe that it should not affect results of other parts of the expression. Checking for employees without a company feels like a third condition that should be explicitly stated.

    I know I can call “outer()” on a property every time I’m constructing paths to query on, however, that gets old fast (and easy to forget), so currently I’m doing string replace in my paths, replacing “.” with “+.”. That makes me feel dirty.

    So, I ask: Is there any way for me to ask Cayenne to implicitly perform outer joins when filtering on expressions, unless explicitly otherwise stated? For example, when modeling relationships? (as is done in EOF)

    Cheers,
    - hugi

    // Hugi Thordarson
    // http://www.loftfar.is/ <http://www.loftfar.is/>
    // s. 895-6688

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedAug 27, '15 at 3:37p
activeAug 28, '15 at 7:16a
posts3
users2
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase