I use QueryDSL for literal query generation like this:
@Test
public void createEqualsQuery() {
final Configuration configuration = new Configuration(SQLServer2008Templates.builder().printSchema().build());
configuration.setUseLiterals(true);
final SimplePath<Object> table = Expressions.path(Object.class, "Tablename");
final StringPath column = Expressions.stringPath(table, "aColumn");
final SQLQuery sqlQuery = new SQLQuery(configuration).from(table).where(column.eq("A filter text"));
System.out.println(sqlQuery.getSQL(column).getSQL());
}
When I filter for an address like:
Carrera 52 con Ave. Bolívar #65-98 Llano Largo
the resulting query checks for:
Carrera 52 con Ave. Bolívar #-33 Llano Largo
I understand this is caused by "normalization" when the query is serialized, although I can't really imagine any reasonable scenario for this behaviour to be useful (for Strings).
I also unterstand that "normalization" can be disabled by calling setNormalization(false) for the Serializer.
Is this behaviour intended? If yes, how can I disable it in my scenario since getSQL(Expression...) creates a local Serializer object that I cannot modify from outside?
Best regards
Lars