目前遇到的有几种情况会导致这样的问题
1、对应的数据表没有设置主键
解决方案:

设置主键


2、使用了 mysql-connector-java-8.0.15.jar 或 其他高版本的mysql数据库驱动
解决方案:

在jdbcConnection中添加userInformationSchema属性,并设值为true
 

<jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&amp;characterEncoding=utf8&amp;serverTimezone=UTC"
	userId="root" password="root">
	<property name="useInformationSchema" value="true"/>
</jdbcConnection>

3、table属性中设置了enable*ByPrimaryKey = "false"属性

<table tableName="user_detail_info" domainObjectName="UserDetailInfo"
       enableDeleteByPrimaryKey="false"
       enableSelectByPrimaryKey="false"
       enableUpdateByPrimaryKey="false"
       enableCountByExample="false"
       enableDeleteByExample="false"
       enableSelectByExample="false"
       enableUpdateByExample="false">
</table>

解决方案

去除enable*ByPrimaryKey = "false"属性,或者设置为true

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐