huishao_tongzhou 2021-07-04 17:40 采纳率: 100%
浏览 113
已结题

mybati逆向工程报错Column 'IS_GENERATEDCOLUMN' not found.

我的mybatis-generation的xml文件(名字叫mbg.xml)是这样的:

<!DOCTYPE generatorConfiguration PUBLIC
        "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
    <context id="DB2Tables" targetRuntime="MyBatis3">
        <!-- 生成的pojo,将implements Serializable-->
        <plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>
        <!--        数据源-->
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL="jdbc:mysql://localhost:3306/ssm_crud?useUnicode=true&amp;characterEncoding=utf-8"
                        userId="root" password="123456"/>
<!--        异常信息的处理-->
        <javaTypeResolver>
            <property name="forceBigDecimals" value="false"/>
        </javaTypeResolver>
<!--        指定Javabean生成的位置-->
        <javaModelGenerator targetPackage="com.huishao.beans" targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>
<!--指定映射文件的位置-->
        <sqlMapGenerator targetPackage="mapper" targetProject=".\src\main\resources">
            <property name="enableSubPackages" value="true"/>
        </sqlMapGenerator>
<!--指定dao接口生成的位置-->
        <javaClientGenerator type="XMLMAPPER" targetPackage="com.huishao.dao" targetProject=".\src\main\java">
            <property name="enableSubPackages" value="true"/>
        </javaClientGenerator>

        <table tableName="tbl_emp" domainObjectName="Employee" />
        <table tableName="tbl_dept" domainObjectName="Department"/>

    </context>
</generatorConfiguration>

我的主程序:

public class Test1 {
    public static void main(String[] args) throws Exception {
        List<String> warnings = new ArrayList<String>();
        boolean overwrite = true;
        File configFile = new File("D:\\disk1\\softdata\\idea-workspace\\SSM\\ssm-crud\\mbg.xml");
        ConfigurationParser cp = new ConfigurationParser(warnings);
        Configuration config = cp.parseConfiguration(configFile);
        DefaultShellCallback callback = new DefaultShellCallback(overwrite);
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
        myBatisGenerator.generate(null);
    }
}

补充:主程序之前在写File configFile = new File()的时候只写的mbg.xml没有写绝对路径,因为我的mbg.xml在工程根目录下,以为程序会找到这个文件,结果就报找不到mbg.xml文件的异常,然后才改成上面的绝对路径。改完之后就报了这个异常:Exception in thread "main" java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found.

希望有大神朋友指导,谢谢。

  • 写回答

2条回答 默认 最新

  • CSDN专家-sinJack 2021-07-04 17:46
    关注

    可能使用到的jar版本不一致:
    参考一下:https://blog.csdn.net/wu_ri_san_xing/article/details/72900199

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月1日
  • 已采纳回答 8月24日

悬赏问题

  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题
  • ¥30 酬劳2w元求合作写文章
  • ¥15 在现有系统基础上增加功能
  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”