0

我试图从三个表中生成“MyBatis Generator”映射器,前两个在一个数据库中(derby 示例),最后一个在另一个数据库中(BIRT 示例)。

我在 derby 中使用 RAD 8.5。

这是我的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:\Users\XXX\IBM\rationalsdp\workspace\Example\WebContent\WEB-INF\lib\derby.jar"/>

  <!--  Primo database -->
    <context id="DerbyTables" targetRuntime="MyBatis3">

        <jdbcConnection driverClass="org.apache.derby.jdbc.EmbeddedDriver"
            connectionURL="jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\com.ibm.datatools.db2.cloudscape.driver\SAMPLE;create=true"
            userId="admin" password="admin">
        </jdbcConnection>

        <javaTypeResolver >
          <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>

        <javaModelGenerator targetPackage="test.model" targetProject="Example\src">
          <property name="enableSubPackages" value="true" />
          <property name="trimStrings" value="true" />
        </javaModelGenerator>

        <sqlMapGenerator targetPackage="test.dao.samp"  targetProject="Example">
          <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <javaClientGenerator type="XMLMAPPER" targetPackage="test.dao"  
                                targetProject="Example\src">
          <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <table schema="SAMP" tableName="STAFF" domainObjectName="staff">
            <property name="useActualColumnNames" value="true" />
        </table>

        <table schema="SAMP" tableName="SALES" domainObjectName="sales">
            <property name="useActualColumnNames" value="true" />
        </table>    

  </context>

  <!-- Secondo database -->
  <context id="SecondTables" targetRuntime="MyBatis3">
        <jdbcConnection driverClass="org.apache.derby.jdbc.EmbeddedDriver"
            connectionURL="jdbc:derby:C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample;create=true"
            userId="admin" password="admin">
        </jdbcConnection>

        <javaTypeResolver >
          <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>

        <javaModelGenerator targetPackage="test.model" targetProject="Example\src">
          <property name="enableSubPackages" value="true" />
          <property name="trimStrings" value="true" />
        </javaModelGenerator>

        <sqlMapGenerator targetPackage="test.dao.samp"  targetProject="Example">
          <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <javaClientGenerator type="XMLMAPPER" targetPackage="test.dao"  
                                targetProject="E\src">
          <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <table schema="CLASSICMODELS" tableName="OFFICES" domainObjectName="offices">
            <property name="useActualColumnNames" value="true"/>
        </table>      
  </context>

</generatorConfiguration>

当我在生成器配置文件上单击右键时,出现以下错误:

启动数据库失败

'C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample' with class loader java.net.URLClassLoader@5ffe2fe7, see the next exception for details.
Failed to start database 'C:\Users\XXX\IBM\rationalsdp\workspace\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample' with class loader java.net.URLClassLoader@5ffe2fe7, see the next exception for details.

我找不到有关此问题的任何指南。

有人知道我的错误在哪里,或者知道一些关于带有多个数据库的 mybatis 生成器的指南吗?

4

1 回答 1

0

看起来您正在尝试连接到 BIRT 示例数据库。您的 Derby 数据库可能已经启动。您可以添加 ;shutdown=true 并运行一次,然后离开 create=true 并重试您的生成。

于 2015-03-17T19:54:16.310 回答