How to set sql_mode hibernate

此生再无相见时 提交于 2019-11-28 08:25:41

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!