Question

I use ibator eclipse plugin 1.2.1. My RDBMS is MySQL 5.1. I have a ibator config file as shown below:

        <?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>

All generated codes are in com.xxx.core.domain but I want Account class in com.xxx.core.domain.account and Personel class in com.xxx.core.domain.personel. How could I do that? (In ibator we can put schema="myschema" on table tag but MySQL does not support schema) Thanks.

Was it helpful?

Solution

I found the solution. runtimeSchema (whether database support schema or not. It does not important. It just works) can be used for this purpose for example:

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

However ibator prepends runctimeSchema to every table. It will produce account.account as a table name (instead of just account) which will not work. But you can write a script to delete all prefixes.

OTHER TIPS

If you are looking for complete (working) example then, i found http://ganeshtiwaridotcomdotnp.blogspot.com/2011/05/tutorial-on-ibatis-using-eclipse-ibator_31.html might help you.

This article explains steps for configuring ibatis with ibator plugin. And working sample examples with downloadable code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top