Skip to main content

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

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) 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

...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

Back to the top