Source:
<code>public String rewriteFilterItem(FilterItem item) { Object operand = item.getOperand(); if (operand != null) { final SelectItem selectItem = item.getSelectItem(); if (operand instanceof String) { String str = (String) operand; if (str.indexOf('\'') != -1) { str = escapeQuotes(str); FilterItem replacementFilterItem = new FilterItem(selectItem, item.getOperator(), str); return super.rewriteFilterItem(replacementFilterItem); } } else if (operand instanceof Timestamp) { final OperatorType operator = item.getOperator(); StringBuilder sb = new StringBuilder(); sb.append(selectItem.getSameQueryAlias(false)); FilterItem.appendOperator(sb, operand, operator); <START> sb.append("TIMESTAMP \'" + operand.toString() + "\'"); <END> return sb.toString(); } else if (operand instanceof Iterable || operand.getClass().isArray()) { assert OperatorType.IN.equals(item.getOperator()); @SuppressWarnings("unchecked") final List<Object> elements = (List<Object>) CollectionUtils.toList(operand); for (ListIterator<Object> it = elements.listIterator(); it.hasNext();) { Object next = it.next(); if (next == null) { logger.warn( "element in IN list is NULL, which isn't supported by SQL. Stripping the element from the list: {}", item); it.remove(); } else if (next instanceof String) { String str = (String) next; if (str.indexOf('\'') != -1) { str = escapeQuotes(str); it.set(str); } } } FilterItem replacementFilterItem = new FilterItem(selectItem, item.getOperator(), elements); return super.rewriteFilterItem(replacementFilterItem); } } return super.rewriteFilterItem(item); }</code><technical_language>a good idea a protected method "rewriteTimestamp(Timestamp)" easily overwrite in deviating dialects</technical_language>

Target:
public String rewriteFilterItem(FilterItem item) { Object operand = item.getOperand(); if (operand != null) { final SelectItem selectItem = item.getSelectItem(); if (operand instanceof String) { String str = (String) operand; if (str.indexOf('\'') != -1) { str = escapeQuotes(str); FilterItem replacementFilterItem = new FilterItem(selectItem, item.getOperator(), str); return super.rewriteFilterItem(replacementFilterItem); } } else if (operand instanceof Timestamp) { final OperatorType operator = item.getOperator(); StringBuilder sb = new StringBuilder(); sb.append(selectItem.getSameQueryAlias(false)); FilterItem.appendOperator(sb, operand, operator); sb.append(rewriteTimestamp((Timestamp) operand)); return sb.toString(); } else if (operand instanceof Iterable || operand.getClass().isArray()) { assert OperatorType.IN.equals(item.getOperator()); @SuppressWarnings("unchecked") final List<Object> elements = (List<Object>) CollectionUtils.toList(operand); for (ListIterator<Object> it = elements.listIterator(); it.hasNext();) { Object next = it.next(); if (next == null) { logger.warn( "element in IN list is NULL, which isn't supported by SQL. Stripping the element from the list: {}", item); it.remove(); } else if (next instanceof String) { String str = (String) next; if (str.indexOf('\'') != -1) { str = escapeQuotes(str); it.set(str); } } } FilterItem replacementFilterItem = new FilterItem(selectItem, item.getOperator(), elements); return super.rewriteFilterItem(replacementFilterItem); } } return super.rewriteFilterItem(item); }