/** * Merges the wrapper hints with the query ones, making sure not to overwrite the query ones * * @param q * @return */ protected Query mergeHints(Query q) { if (this.hints == null || this.hints.isEmpty()) { return q; } Query clone = new Query(q); Hints hints = clone.getHints(); if (hints == null || hints.isEmpty()) { clone.setHints(this.hints); } else { for (Entry<Object, Object> entry : this.hints.entrySet()) { if (!hints.containsKey(entry.getKey())) { hints.put(entry.getKey(), entry.getValue()); } } } return clone; }