错误详情:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'desc, name) values (null, '超级管�员')' at line 1
第一次遇到这个问题,刚开始以为是字符编码的问题,可是其它的test方法也是下正常的。
经过网上搜索之后发现,最终的原因是:我的实体类的字段包含了desc ,该字段与SQL中的关键字DESC一样了。
推论:表中的字段不可与SQL中的关键字相同!
此外,若是改为describe也是冲突的。最终改为descript即可。