JDOQL Any way to avoid multiple .contains() calls in the query when searching for the presence of on
Posted
by Finbarr
on Stack Overflow
See other posts from Stack Overflow
or by Finbarr
Published on 2010-04-07T11:11:57Z
Indexed on
2010/04/07
11:13 UTC
Read the original article
Hit count: 214
The question pretty much says it all.
If I have a class Class A
public class A {
...
private List<String> keys;
...
}
And I want to select all A
instances from the DataStore that have atleast one of a List of keys, is there a better way of doing it than this:
query = pm.newQuery(A.class);
query.setFilter("keys.contains(:key1) || keys.contains(:key2) || keys.contains(:key3)");
List<A> results = (List<A>)query.execute(key1, key2, key3);
This has not yet been implemented, so I am open to radical suggestions.
© Stack Overflow or respective owner