Brett Meyer commented on an issue
Hibernate ORM / Bug HHH-8245
Lock generating wrong SQL and exception vs DB2
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(....