博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
解决 Mybatis Generator由表字段使用关键字导致的异常方案
阅读量:4227 次
发布时间:2019-05-26

本文共 363 字,大约阅读时间需要 1 分钟。

引言

前几天由于用python拉取第三方接口的数据以后,他们直接返回建表的字段和命令,也就说我们必须按照他们设定的字段名称来使用,他们的命名里面有很多的mysql的关键字,这就说我们写sql的时候,需要注意关键字,但是我们后端用的mybatis Generator,这就导致各种错误,因为之前没有遇到过这种场景,所以晚上查询了很多资料,最后在官网上找到了解决方案,其实很简单。

 在context节点中增加如下属性为关键字添加属性:

 

需要注意的是Mybatis Generator为关键词添加的分隔符为(””)双引号,这在MySQL中是不对的,所以我们需要借助beginningDelimiter、endingDelimiter属性修改默认分隔符:

OK,搞定运行,你就会发现关键词已经被加上`分隔符了。

 

转载地址:http://fsnqi.baihongyu.com/

你可能感兴趣的文章
Mastering Active Directory
查看>>
Mobile Application Development with SMS and the SIM Toolkit
查看>>
Web Development With SAS by Example
查看>>
Unix Power Tools, Third Edition [ILLUSTRATED]
查看>>
Financial Analysis with Microsoft Excel
查看>>
Web Metrics: Proven Methods for Measuring Web Site Success
查看>>
Windows Vista: The Missing Manual
查看>>
Access 2007: The Missing Manual
查看>>
Word 2007: The Missing Manual
查看>>
CSS, DHTML, and Ajax, Fourth Edition
查看>>
SMS 2003 Administrator's Reference: Systems Management Server 2003
查看>>
Service Oriented Architecture For Dummies
查看>>
Excel 2007: The Missing Manual [ILLUSTRATED]
查看>>
The PEAR Installer Manifesto
查看>>
WordPress Complete: set up, customize, and market your blog
查看>>
Backup & Recovery
查看>>
Creating your MySQL Database: Practical Design Tips and Techniques
查看>>
Ajax on Rails
查看>>
Groovy in Action
查看>>
Windows Vista: Visual QuickStart Guide
查看>>