mybatis生成器“列名模式不能为NULL或为空" [英] mybatis generator "Column name pattern can not be NULL or empty"

查看:113
本文介绍了mybatis生成器“列名模式不能为NULL或为空"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在日食中使用MyBatis Generator.这是generatorConfig.xml文件.当我右键单击并选择生成MyBatis工件"时,它向我显示诸如列名模式不能为NULL或为空"的错误消息.

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>

您能帮我吗? 谢谢!

推荐答案

这是MySQL连接器从版本5.x更改为版本6.x的注释

This is a change in MySQL Connector from version 5.x to 6.x as commented here.

为了使MyBatis与6.x一起使用,可以将nullNamePatternMatchesAll=true附加到JDBC字符串中.您可能必须在XML中将&转换为&amp;.

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 &amp; in your XML.

这篇关于mybatis生成器“列名模式不能为NULL或为空"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆