Quantcast

DAO impl class missing when using mybatis eclipse generatio for MyBatis3 targetRunTime

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

DAO impl class missing when using mybatis eclipse generatio for MyBatis3 targetRunTime

Asim Hussain
The generator runs fine BUT if I am using targetRunTime: MyBatis3, I
do not get a DAO impl class generated.  I just get a DAO interface.
When I use targetRunTime: Ibatis2Java2 or Ibatis2Java5, I get Spring
DAO interfaces and an Impl default class.

I am actually looking to work with Spring DAO's (interface and Impl)
and also want to take advantage of MyBatis3.  Please advise.

This is my config file:

<?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 >
  <context id="context1" targetRuntime="MyBatis3">
    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@192.168.13.90:1521:ZOO" userId="abc"
password="abc" />
    <javaModelGenerator targetPackage="test.yyz.model"
targetProject="ProspectInfinitiPortal\src">
    <property name="enableSubPackages" value="true" />
    <property name="trimStrings" value="true" />
    </javaModelGenerator>
    <sqlMapGenerator targetPackage="test.xml"
targetProject="ProspectInfinitiPortal\src">
    <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>
    <javaClientGenerator targetPackage="test.yyz.dao"
targetProject="ProspectInfinitiPortal\src" type="XMLMAPPER">
    <property name="enableSubPackages" value="true" />
    </javaClientGenerator>
    <table schema="NIS_PTL_WRK" tableName="PTL_VEHICLE"
domainObjectName="PTL_VEHICLE">
      <property name="useActualColumnNames" value="true"/>
      <generatedKey column="VEHICLE_ID" sqlStatement="JDBC"
identity="true" />
    </table>
  </context>
</generatorConfiguration>

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: DAO impl class missing when using mybatis eclipse generatio for MyBatis3 targetRunTime

Jeff Butler
MyBatis3 does not need implementation classes.  The framework
generates them automatically at run time.

Take a look at MyBatis Spring integration for a better way to do this than DAOs.

http://mybatis.org/spring/

Jeff Butler

On Thu, Mar 29, 2012 at 12:46 PM, Asim Hussain <[hidden email]> wrote:

> The generator runs fine BUT if I am using targetRunTime: MyBatis3, I
> do not get a DAO impl class generated.  I just get a DAO interface.
> When I use targetRunTime: Ibatis2Java2 or Ibatis2Java5, I get Spring
> DAO interfaces and an Impl default class.
>
> I am actually looking to work with Spring DAO's (interface and Impl)
> and also want to take advantage of MyBatis3.  Please advise.
>
> This is my config file:
>
> <?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 >
>  <context id="context1" targetRuntime="MyBatis3">
>    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
> connectionURL="jdbc:oracle:thin:@192.168.13.90:1521:ZOO" userId="abc"
> password="abc" />
>    <javaModelGenerator targetPackage="test.yyz.model"
> targetProject="ProspectInfinitiPortal\src">
>        <property name="enableSubPackages" value="true" />
>        <property name="trimStrings" value="true" />
>    </javaModelGenerator>
>    <sqlMapGenerator targetPackage="test.xml"
> targetProject="ProspectInfinitiPortal\src">
>        <property name="enableSubPackages" value="true" />
>    </sqlMapGenerator>
>    <javaClientGenerator targetPackage="test.yyz.dao"
> targetProject="ProspectInfinitiPortal\src" type="XMLMAPPER">
>        <property name="enableSubPackages" value="true" />
>    </javaClientGenerator>
>    <table schema="NIS_PTL_WRK" tableName="PTL_VEHICLE"
> domainObjectName="PTL_VEHICLE">
>      <property name="useActualColumnNames" value="true"/>
>      <generatedKey column="VEHICLE_ID" sqlStatement="JDBC"
> identity="true" />
>    </table>
>  </context>
> </generatorConfiguration>
>
> Thanks.
Loading...