使用mybatis generator 生成annotation形式的mapper

人生难得几回搏,此时不搏待何时。这篇文章主要讲述使用mybatis generator 生成annotation形式的mapper相关的知识,希望能为你提供帮助。
【使用mybatis generator 生成annotation形式的mapper】        最近使用mybatisgenerator时,希望生成annotation的mapper,在网上基本桑没有相关配置,记录,做以下记录:



[html] view plain copy print?

  1. < ?xml  version="1.0"  encoding="UTF-8"  ?>    
  2. < !DOCTYPE  generatorConfiguration  PUBLIC  "-//mybatis.org//DTD  MyBatis  Generator  Configuration  1.0//EN"  "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"  >    
  3. < generatorConfiguration  > < classPathEntry   
  4.                 location="jar包位置"  />    
  5.     < context  id="context1"  >    
  6.         < jdbcConnection  driverClass="driver"  connectionURL="jdbc"  userId="**"  password="**"  />    
  7.         < javaModelGenerator  targetPackage="package"  targetProject="project"  />    
  8.         < sqlMapGenerator  targetPackage="package"  targetProject="project"  /> < /span>    
  9.         < javaClientGenerator  targetPackage="package"  targetProject="project"  type="< span  style="color:#ff0000; "> ANNOTATEDMAPPER/XMLMAPPER< /span> "  />    
  10.    
  11.         < table  schema="schema"  tableName="table"    domainObjectName="javaBean"  >    
  12.         < /table>    
  13.            
  14.     < /context>    
  15. < /generatorConfiguration>    
< ?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 > < classPathEntrylocation="jar包位置" /> < context id="context1" > < jdbcConnection driverClass="driver" connectionURL="jdbc" userId="**" password="**" /> < javaModelGenerator targetPackage="package" targetProject="project" /> < sqlMapGenerator targetPackage="package" targetProject="project" /> < /span> < javaClientGenerator targetPackage="package" targetProject="project" type="< span style="color:#ff0000; "> ANNOTATEDMAPPER/XMLMAPPER< /span> " /> < table schema="schema" tableName="table"domainObjectName="javaBean" > < /table> < /context> < /generatorConfiguration>






    推荐阅读