简单处理方法
直接在 @Column 增加 name参数即可,数据库字段不需要修改
@Column(name = "\"lastValue\"",nullable = false)
@Column(name = "[lastValue]",nullable = false)
@Column(name = "`lastValue`",nullable = false)
<property name="lastValue" type="string">
<column name='"lastValue"' not-null="true"/>
</property>
<property name="lastValue" type="string">
<column name='[lastValue]' not-null="true"/>
</property>
<property name="lastValue" type="string">
<column name='`lastValue`' not-null="true"/>
</property>
从网上找得其他方法都没生效,这里记录下,万一你们用到了可以试试
第一种:自动在执行的sql关键字上添加反引号``
// 配置文件
hibernate.auto_quote_keyword=true
// 同时在spring文件中配置
<prop key="hibernate.auto_quote_keyword">true</prop>
第二种:设置给所有的列名加反引号
hibernate.globally_quoted_identifiers=true