ssh 数据库表中使用关键字新增失败的解决方案

当表字段中存在关键字:插入时候会报如下的错误:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from, status, to, id) values ('1', '1','1','1','1','2')' at line 1

在userAddress.hbm.xml中

错误:

<property name="default_" type="java.lang.Boolean">
            <column name="default" not-null="true" />
   </property>

正确:column字段中应该使用引号(键盘数字1前面的符号)

<property name="default_" type="java.lang.Boolean">
            <column name="`default`" not-null="true" />
        </property>

猜你喜欢

转载自blog.csdn.net/cheng_zhang_zhong/article/details/89102567
今日推荐