javamybatismybatis-generatormybatis-mapper

after first time myBatis generator getting lots of "cannot be resolved to a type"


launched for first time myBatis generator using this instructions: https://mybatis.org/generator/running/runningWithEclipse.html

this is my generatorConfig.xml

<?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:/***/ojdbc6.jar"/>
  <context id="context">
    <jdbcConnection
        connectionURL="jdbc:oracle:thin:***:***/***"
        driverClass="oracle.jdbc.driver.OracleDriver"
        password="***"
        userId="***" />
    <javaModelGenerator
        targetPackage="***.model"
        targetProject="***-dao" />
    <javaClientGenerator
        targetPackage="***.mapper"
        targetProject="***-dao"
        type="XMLMAPPER" />
    <table
        schema="***"
        tableName="USERS">
    </table>
  </context>
</generatorConfiguration>

In eclipse - run as - run myBatis genarator.

Got what I guess is the right code generated, in the right project and package. Anyway:

in my pom I have (related to myBatis) these dependencies:

<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
</dependency>
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-cdi</artifactId>
    <version>1.1.0</version>
</dependency>

maybe I'm missing something else in pom? Or other problems, maybe some missing or bad configs in generatorConfig?


Solution

  • after a little of search on internet I found the jar in which are defined those classes, then searched on mvn and found the right dependency:

    <!-- https://mvnrepository.com/artifact/org.mybatis.dynamic-sql/mybatis-dynamic-sql -->
    <dependency>
        <groupId>org.mybatis.dynamic-sql</groupId>
        <artifactId>mybatis-dynamic-sql</artifactId>
        <version>1.1.4</version>
    </dependency>