mybatis 使用eclipse 生成实体类

1.安装插件

下载 MyBatis_Generator_1.3.1.zip,解压架包把features、plugins文件夹下的架包分别拷贝到eclipse安装目录下的features、plugins文件夹。重启eclipse

2.ctrl+N 建generatorConfig.xml文件

3.配置generatorConfig.xml



<generatorConfiguration >
    <classPathEntry location="F:\oracle\product\10.1.0\Db_1\jdbc\lib\classes12.jar"/>
  <context id="context1" >
    <jdbcConnection driverClass="oracle.jdbc.OracleDriver" connectionURL="jdbc:oracle:thin:@192.168.5.25:1521:orcl" userId="myBatis" password="test" />
    <javaModelGenerator targetPackage="com.student.pojo" targetProject="ssm" />
    <sqlMapGenerator targetPackage="com.student.pojo" targetProject="ssm" />
    <javaClientGenerator targetPackage="com.student.pojo" targetProject="ssm" type="XMLMAPPER"/>

    <table schema="myBatis" tableName="student" >
      <columnOverride column="id" property="id" />
    table>
  context>
generatorConfiguration>

右击generatorConfig.xml 点击Generate MyBatis/iBATIS Artifacts 生成对应接口、接口映射文件、实体类

你可能感兴趣的:(MyBatis)