-
1. Re: search by partial field of composite key
anistor Jun 6, 2017 5:54 AM (in response to sea_shankar)Hi,
searching by key is not supported, and searching by a part of the key is not supported either. You can only retrieve entries by knowing the exact key. Or you can also search for values based on their fields.
A possible workaround for you is to put that part of the key in the value as a field and search for it.
Adrian
-
2. Re: search by partial field of composite key
sea_shankar Jun 6, 2017 10:57 AM (in response to anistor)Thanks, I decided to try and use the entrySet().stream to filter out key that contains the partial key. however having trouble as it throws unsupported exception.
I have a RemoteCache<Object,Object> cache;
cache.put("hello","hello")
Tried the following:
Works:
cache.keySet().stream().filter(e -> e.toString().contains("hello")).forEach(e -> log.info(e.toString()));
Unsupported Exception:
cache.entrySet().stream().filter(e -> e.toString().contains("hello")).forEach(e -> log.info(e.toString()));
Get this exception: java.lang.UnsupportedOperationException: null
Any idea?
-
3. Re: search by partial field of composite key
rvansa Jun 7, 2017 3:49 AM (in response to sea_shankar)Exceptions have stacktraces...
-
4. Re: search by partial field of composite key
sea_shankar Jun 7, 2017 12:38 PM (in response to rvansa)Sorry for that, I was able to get an answer from another thread. Seems RemoteCache doesn't have entrySet() functionality.
https://developer.jboss.org/message/972865?et=watches.email.thread#972865