4

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

Thanks,

Stefano

Stefano Cazzola
  • 1,597
  • 1
  • 20
  • 36

1 Answers1

5

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'
Mikko Maunu
  • 41,366
  • 10
  • 132
  • 135