我在 eclipse 中使用 MyBatis Generator。这是generatorConfig.xml 文件。当我右键单击并选择“生成 MyBatis 工件”时,它会显示错误消息,例如“列名称模式不能为 NULL 或空”。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<classPathEntry
location="C:\Users\myplace\.m2\repository\mysql\mysql-connector-java\6.0.2\mysql-connector-java-6.0.2.jar" />
<context id="context1">
<plugin type="org.mybatis.generator.plugins.SerializablePlugin" />
<plugin type="org.mybatis.generator.plugins.ToStringPlugin" />
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/world?serverTimezone=EST"
userId="root" password="root" />
<javaModelGenerator targetPackage="com.example.ws.model" targetProject="com.example.ws" />
<sqlMapGenerator targetPackage="com.example.ws.sql" targetProject="com.example.ws" />
<javaClientGenerator targetPackage="com.example.ws.mapper" targetProject="com.example.ws" type="ANNOTATEDMAPPER" />
<table schema="world" tableName="city">
<columnOverride column="ID" property="id" javaType = "Integer" />
<columnOverride column="Name" property="name" javaType = "String" />
<columnOverride column="CuntryCode" property="cuntryCode" javaType = "String" />
<columnOverride column="District" property="district" javaType = "String" />
<columnOverride column="Population" property="population" javaType = "BigDecimal" />
</table>
</context>
</generatorConfiguration>
你能帮我一下吗?
谢谢你!
这是 MySQL 连接器从版本 5.x 到 6.x 的更改,如注释所示here.
为了让 MyBatis 与 6.x 一起工作,你可以附加nullNamePatternMatchesAll=true
到您的 JDBC 字符串。你可能必须逃离&
to &
在您的 XML 中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)