本机调试保存数据时报错:
Hibernate: /* insert com.kyhtech.health.entity.bbs.Comment */ insert into co_comment (content, deleted, images, imei, m_id, member_id, post_title, pub_date, reply_id, reply_flag, reply_member_id, top, type, virtual) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2017-04-28 15:20:52,153 [http-nio-8080-exec-8] WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - SQL Error: 1064, SQLState: 420002017-04-28 15:20:52,154 [http-nio-8080-exec-8] ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - 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 'virtual) values ('普京对外的强硬和对内的表现 鲜明对比', 0, nul' at line 1
根据日志提示是“virtual”字段存在问题,但是生产环境是正常的。本机MySQL是5.7,生产环境用5.6的,应该跟数据库版本有关系。果然搜索到virtual是MySQL5.7的新关键字。详见:http://blog.itpub.net/30633755/viewspace-2127708/
解决方法:修改字段名称virtual改成is_virtual