Question

Is there a way to set the sql_mode (for MySql database) in Hibernate properties or in connection string?

Thanks,

Stefano

Was it helpful?

Solution

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'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top