2016-06-28 2 views
3

Eclipse에서 MyBatis Generator를 사용하고 있습니다. 다음은 generatorConfig.xml 파일입니다. 마우스 오른쪽 버튼을 클릭하여 "MyBatis 아티팩트 생성"을 선택하면 "열 이름 패턴을 NULL 또는 비워 둘 수 없습니다."라는 오류 메시지가 표시됩니다.mybatis generator "열 이름 패턴을 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> 

도와 주시겠습니까? 감사합니다.

답변

4

이전에 같은 오류가 발생했습니다 .db 드라이버가 원인 일 수 있습니다. mysql 커넥터를 6.0.3에서 5.1.38로 변경 한 후에는 절대로 다시 나오지 않습니다.

mysql 커넥터를 변경하려고 할 수 있습니다.

10

이것은 MySQL 커넥터가 버전 5.x에서 6.x로 바뀌 었음을 의미합니다 (here).

6.x에서 MyBatis 작동을 얻으려면 nullNamePatternMatchesAll=true을 JDBC 문자열에 추가 할 수 있습니다. XML의 &에서 &amp;으로 탈출해야 할 수도 있습니다.