在myeclipse中安装和使用mybatis generator,不仅在eclipse中适用哦

1.下载mybatis生成工具,解压出来的features、plugins文件夹下放到myeclipse安装目录下覆盖,重启myeclipse。
2.在webContent根目录下创建generatorConfig.xml




<generatorConfiguration >
<classPathEntry
        location="C:\Users\lians\Desktop\mysql-connector-java-5.1.21.jar" />
  <context id="context1" >

    <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://192.168.1.111:3306/xxxx?useUnicode=true&characterEncoding=UTF-8" userId="xxxx" password="xxxx" />
    <javaModelGenerator targetPackage="com.xxxx.model"  targetProject="xxxx" />
    <sqlMapGenerator targetPackage="com.xxxx.mapping" targetProject="xxxx" />
    <javaClientGenerator targetPackage="com.xxxx.dao"  targetProject="xxxx" type="XMLMAPPER" />
        <table schema="xxxx" tableName="user"  domainObjectName="User"  >
        table>

  context>
generatorConfiguration>

3.右击generatorConfig.xml选则Generate MyBatis/iBATIS Artifacts即可生成对应接口、接口映射文件和 实体类。
很方便哦

你可能感兴趣的:(jsp)