Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Are query.setHint() calls additive?

We don't use getHints() to update our queries. Instead, as hints are added, we change the settings on our queries directly (and update the hings list). The bug is likely in the updating of the hints list.

On 22/05/2013 10:50 AM, Laird Nelson wrote:
Thanks, Tom; that helps.  I assume, then, that internally EclipseLink is not
using getHints() to find all the query hint values, but is rather installing
those values at setHint() time directly.  (I'll look at the code.)  The
specification could be much more clear on this; I'll head over to the JSR users
list.

Thanks,
Best,
Laird


On Wed, May 22, 2013 at 5:22 AM, Tom Ware <tom.ware@xxxxxxxxxx
<mailto:tom.ware@xxxxxxxxxx>> wrote:

    eclipselink.join-fetch can be multiple times on the same query without issue.

    There appears to be a bug in getHints() that will mean getHints() will only
    return the most recently added eclipselink.join-fetch hint in its map.
    (please feel free to enter this bug)


    On 22/05/2013 12:32 AM, Laird Nelson wrote:

        I'm being reintroduced to the eclipselink.join-fetch query hint.

        I found a query where it would be handy to have two of these, i.e. two
        join-fetch hints.

        I noticed that the EclipseLink documentation
        (http://wiki.eclipse.org/__EclipseLink/UserGuide/JPA/__Basic_JPA_Development/Query___Hints#Join_Fetch
        <http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Query_Hints#Join_Fetch>)
        is mum on whether this is possible or not.

        The Javadoc for the Query#setHint(String, Object) method makes it look
        like a
        standard map operation (i.e. it should be putHint(String, Object)).  And
        getHints() returns a Map, which of course would not contain duplicate keys.

        But then I stumbled on this:
        https://github.com/mysema/__querydsl/issues/348
        <https://github.com/mysema/querydsl/issues/348>

        ...and that seems to suggest that duplicate keys are just fine.

        I'm leery of things that happen to work.  I'd much rather trust them because
        they are known to work, or are designed to work.  :-)

        So: may I do something like this:

        query.setHint("eclipselink.__join-fetch", "a.b");
        query.setHint("eclipselink.__join-fetch", "a.c");

        ...?

        Best,
        Laird

        --
        http://about.me/lairdnelson


        _________________________________________________
        eclipselink-users mailing list
        eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
        https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
        <https://dev.eclipse.org/mailman/listinfo/eclipselink-users>

    _________________________________________________
    eclipselink-users mailing list
    eclipselink-users@xxxxxxxxxxx <mailto:eclipselink-users@xxxxxxxxxxx>
    https://dev.eclipse.org/__mailman/listinfo/eclipselink-__users
    <https://dev.eclipse.org/mailman/listinfo/eclipselink-users>




--
http://about.me/lairdnelson


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top