private void searchCustomers() { String jSonDave = (String) customerTemplate.findUnique("select * from /Customer where emailAddress.value=$1","dave@matthews.com"); log.info(jSonDave); SelectResults<String> results = customerTemplate.find("select * from /Customer where emailAddress.value=$1", "alicia@keys.com"); String jSonAlicia = results.iterator().next(); log.info(jSonAlicia); }
/** * Finds all available {@link Session Sessions} with the particular attribute indexed by {@link String name} * having the given {@link Object value}. * * @param indexName {@link String name} of the indexed {@link Session} attribute. * (e.g. {@link org.springframework.session.FindByIndexNameSessionRepository#PRINCIPAL_NAME_INDEX_NAME}). * @param indexValue {@link Object value} of the indexed {@link Session} attribute to search on * (e.g. {@literal username}). * @return a mapping of {@link Session#getId()} Session IDs} to {@link Session} objects. * @see org.springframework.session.Session * @see java.util.Map * @see #prepareQuery(String) * @see #commit(Session) * @see #configure(Session) * @see #registerInterest(Session) * @see #touch(Session) */ @Override public Map<String, Session> findByIndexNameAndIndexValue(String indexName, String indexValue) { SelectResults<Session> results = getSessionsTemplate().find(prepareQuery(indexName), indexValue); Map<String, Session> sessions = new HashMap<>(results.size()); results.asList().forEach(session -> sessions.put(session.getId(), touch(commit(registerInterest(configure(session)))))); return sessions; }