0

私はibatoreclipseプラグイン1.2.1を使用しています。私のRDBMSはMySQL5.1です。以下に示すようなibator設定ファイルがあります。

        <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration>
  <classPathEntry location="/mysql-connector-java-5.1.7-bin.jar"/>
  <ibatorContext defaultModelType="flat" id="context1"  targetRuntime="Ibatis2Java5">
    <jdbcConnection connectionURL="jdbc:mysql://localhost:3306/database" driverClass="com.mysql.jdbc.Driver" password="pass" userId="root"/>
    <javaModelGenerator targetPackage="com.xxx.core.domain" targetProject="Myproject">
        <property name="enableSubPackages" value="true"/>
        <property name="trimStrings" value="true"/>
     </javaModelGenerator>
    <sqlMapGenerator targetPackage="com.xxx.core.dao.ibatis.maps" targetProject="Myproject">
        <property name="enableSubPackages" value="true"/>
    </sqlMapGenerator>
    <daoGenerator  targetPackage="com.xxx.core.dao" targetProject="Myproject" type="SPRING">
        <property name="enableSubPackages" value="true"/>
        <property name="methodNameCalculator" value="extended"/>
    </daoGenerator>
    <table tableName="account"  domainObjectName="Account"/>
    <table tableName="personel"  domainObjectName="Personel"/>
  </ibatorContext>
</ibatorConfiguration>

生成されたコードはすべてcom.xxx.core.domainにありますが、com.xxx.core.domain.accountにAccountクラス、com.xxx.core.domain.personelにPersonelクラスが必要です。どうすればそれができますか?(ibatorでは、schema = "myschema"をテーブルタグに配置できますが、MySQLはスキーマをサポートしていません)ありがとうございます。

4

2 に答える 2

0

私は解決策を見つけました。runtimeSchema(データベースがスキーマをサポートしているかどうか。重要ではありません。機能するだけです)は、次の目的で使用できます。

<table tableName="account"  domainObjectName="Account">
    <property name="runtimeSchema" value="account" />
</table>

ただし、ibatorはすべてのテーブルにrunctimeSchemaを付加します。account.accountを(単なるaccountではなく)テーブル名として生成しますが、これは機能しません。ただし、すべてのプレフィックスを削除するスクリプトを作成できます。

于 2009-07-21T18:39:05.550 に答える
0

完全な(実用的な)例を探しているなら、 http: //ganeshtiwaridotcomdotnp.blogspot.com/2011/05/tutorial-on-ibatis-using-eclipse-ibator_31.htmlが役立つかもしれないことがわかりました。

この記事では、ibatorプラグインを使用してibatisを設定する手順について説明します。そして、ダウンロード可能なコードを使用したサンプル例を実行します。

于 2011-06-10T18:51:27.093 に答える