Here is the code that starts this. I cannot debug this with the source distributed with 4.1.6. Eclipse tells me it doesn't match the .class files. Apparently incorrect SQL is being generated. Logging produces only valid SQL after it has been generated. I am using a custom SQL dialect with one trivial modification, also below.
public static void main(....
This message was sent by Atlassian JIRA (v6.1-OD-09-WN#6144-sha1:62dfc48)