I am using MyBatis Generator in eclipse. Here is the generatorConfig.xml file. When I right click and choose to "generate MyBatis artifacts", it show me the error message like "Column name pattern can not be NULL or empty".
<?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>
Would you please help me with that? Thank you!
This is a change in MySQL Connector from version 5.x to 6.x as commented here.
In order to get MyBatis work with 6.x you could append nullNamePatternMatchesAll=true
to your JDBC string. You probably have to escape the &
to &
in your XML.
I have met the same error before.It might be caused by the db driver. After I change the mysql-connector from 6.0.3 down to 5.1.38,it never comes out again.
You can try to change your mysql-connector.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With