问题
Is there a way to set the sql_mode (for MySql database) in Hibernate properties or in connection string?
Thanks,
Stefano
回答1:
Yes, as documented sessionVariables property which is defined as follows can be used in JDBC connection string:
A comma-separated list of name/value pairs to be sent as SET SESSION ... to the server when the driver connects.
List of values goes inside single quotes:
sessionVariables=sql_mode='ALLOW_INVALID_DATES,NO_BACKSLASH_ESCAPES'
来源:https://stackoverflow.com/questions/14319679/how-to-set-sql-mode-hibernate