当前位置: 首页 > news >正文

做兼职在线抠图网站今日热点头条新闻

做兼职在线抠图网站,今日热点头条新闻,dw做网站可以做毕业设计吗,虚拟机如何做网站MyBatis Generator(MBG),这是官方帮我们提供的一个自动生成代码的工具,前面的课程中,我们都是脑袋里想好,pojo有哪些属性,属性的类型是什么,对应的数据表中的字段名字是什么,匹配的类型是什么..…

MyBatis Generator(MBG),这是官方帮我们提供的一个自动生成代码的工具,前面的课程中,我们都是脑袋里想好,pojo有哪些属性,属性的类型是什么,对应的数据表中的字段名字是什么,匹配的类型是什么.....然后还要写接口xxxDao,以及它的实现配置文件xxxDao.xml等等都是手动自己操作,以前我们学习Hibernate的时候,感觉方便就是写好pojo启动服务器Hibernate会自动帮助我们生成对应的数据表,MyBatis也有类似的工具,MBG就是官方给我提供的这样的工具,但它和Hibernate有点不一样就是,Hibernate帮我们生成表,MBG帮我们根据表生成接口、pojo类和xml这些文件!方向是反的。

要使用MBG首先要导jar包和建立一个XML配置文件

<dependency><groupId>org.mybatis.generator</groupId><artifactId>mybatis-generator-core</artifactId><version>1.3.7</version>
</dependency>

以下元素就是MBG的最小配置

元素指定如何连接数据库

元素指定生成Model的目标package与目标project

元素指定生成Mapping XML文件的目标package与目标project

(Optionally)元素指定生成Mapper(即DAO)文件的目标package与目标project, 如果不指定这个元素就不会生成Mapper文件,至少一个table元素。

下面是一个较为完整的示例, 可以保存下来按需修改

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfigurationPUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN""http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"><generatorConfiguration><!-- 数据库的驱动, JAR/ZIP文件的全路径,maven工程,驱动已经依赖了,没用--><classPathEntry location="/Program Files/IBM/SQLLIB/java/db2java.zip"/><!--targetRuntime用MyBatis3, 也就是默认的, 其他我基本不会用-><context id="DB2Tables" targetRuntime="MyBatis3"><commentGenerator><!-- 去除自动生成的注释 --><property name="suppressAllComments" value="true"/></commentGenerator><!--基础的数据库连接--><jdbcConnection driverClass="COM.ibm.db2.jdbc.app.DB2Driver"connectionURL="jdbc:db2:TEST"userId="db2admin"password="db2admin"></jdbcConnection><!--Java类型解析器, 目前也就只有forceBigDecimals可以给你玩--><javaTypeResolver><!--当数据类型为DECIMAL或者NUMERIC的时候, 如果是true的话则总是使用java.math.BigDecimal--><!--以下是false, 即默认值的情况--><!--如果有小数或者decimal长度大于18, Java类型为BigDecimal--><!--如果没有小数, 以及decimal长度为10至18, Java类型为Long--><!--如果没有小数, 以及decimal长度为5至9, Java类型为Integer--><!--如果没有小数, 以及decimal长度少于5, Java类型为Short--><property name="forceBigDecimals" value="false"/></javaTypeResolver><!--Domain生成器--><javaModelGenerator targetPackage="test.model" targetProject=".\src\main\java"><!--据说可以自动添加schema名, 可是我没用到过--><property name="enableSubPackages" value="true"/><!--生成全属性构造器, 没什么用, 如果有指定immutable元素的话这个会被忽略--><property name="constructorBased" value="true"/><!--生成不可变的domain, 这个我也很少用--><property name="immutable" value="true"/><!--每个Domain都继承这个bean--><property name="rootClass" value="com.github.prontera.domain.base.BasicEntity"/><!--当遇到String的时候setter是否会先trim()--><property name="trimStrings" value="true"/></javaModelGenerator><!--Mapping生成器--><sqlMapGenerator targetPackage="test.xml" targetProject=".\src\main\java"><property name="enableSubPackages" value="true"/></sqlMapGenerator><!--Mapper生成器, 当type为ANNOTATEDMAPPER时是带有@annotation的Mapper, MIXEDMAPPER是XML文件--><javaClientGenerator type="XMLMAPPER" targetPackage="test.dao" targetProject=".\src\main\java"><property name="enableSubPackages" value="true"/><!--每个Mapper所继承的接口--><property name="rootInterface" value="com.github.prontera.Mapper"/></javaClientGenerator><!--字段命名策略过程: <columnRenamingRule> >> property name="useActualColumnNames"--><!--alias属性是个神器, 会为所有SQL都添加, 做关联的时候就非常方便了--><!--至于什么Example, 全关了就是--><table alias="ha" tableName="ALLTYPES" domainObjectName="Customer"enableCountByExample="false" enableUpdateByExample="false"enableDeleteByExample="false" enableSelectByExample="false"selectByExampleQueryId="false"><!--指定是否用数据库中真实的字段名, 而不是采用MBG转换后的驼峰--><property name="useActualColumnNames" value="true"/><!--自动集成改类--><property name="rootClass" value="com.github.prontera.domain.base.HelloBasicClass"/><!--Mapper自动继承的接口--><property name="rootInterface" value="com.github.prontera.Mapper"/><!--当遇到String的时候setter是否会先trim()--><property name="trimStrings" value="true"/><!--先进行columnRenamingRule, 再进行useActualColumnNames. 如果有columnOverride则忽略该配置--><!--关于columnRenamingRule的具体例子 http://www.mybatis.org/generator/configreference/columnRenamingRule.html--><columnRenamingRule searchString="^CUST_"      replaceString=""/><!--顾名思义, 忽略某些列--><ignoreColumn column="CREATE_TIME"/><!--也是忽略数据列, 但是可以通过正则表达式, except子元素是可选的, 代表忽略除UPDATE_TIME外的列--><ignoreColumnsByRegex pattern=".*_TIME$"><except column="UPDATE_TIME"/></ignoreColumnsByRegex></table></context>
</generatorConfiguration>

Java的方法运行插件

   List<String> warnings = new ArrayList<String>();boolean overwrite = true;File configFile = new File("generatorConfig.xml");ConfigurationParser cp = new ConfigurationParser(warnings);Configuration config = cp.parseConfiguration(configFile);DefaultShellCallback callback = new DefaultShellCallback(overwrite);MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);myBatisGenerator.generate(null);


文章转载自:
http://dinncoadenocarcinoma.stkw.cn
http://dinncoabsorbability.stkw.cn
http://dinncoendolymph.stkw.cn
http://dinncobulldiker.stkw.cn
http://dinncotopotaxy.stkw.cn
http://dinncoboundlessly.stkw.cn
http://dinncopreaching.stkw.cn
http://dinncowaddle.stkw.cn
http://dinncoperi.stkw.cn
http://dinncoindusium.stkw.cn
http://dinncopanoplied.stkw.cn
http://dinncocoronet.stkw.cn
http://dinncosphygmometer.stkw.cn
http://dinncokilted.stkw.cn
http://dinncodoughfoot.stkw.cn
http://dinncochromatism.stkw.cn
http://dinncobrushhook.stkw.cn
http://dinncobettor.stkw.cn
http://dinncobarricade.stkw.cn
http://dinncoultrathin.stkw.cn
http://dinncomyristate.stkw.cn
http://dinncogorgonzola.stkw.cn
http://dinncoendoplast.stkw.cn
http://dinncoregina.stkw.cn
http://dinncocarp.stkw.cn
http://dinncolacquerer.stkw.cn
http://dinncoblackbuck.stkw.cn
http://dinncoimpure.stkw.cn
http://dinncoparaplegic.stkw.cn
http://dinncoepideictic.stkw.cn
http://dinncodangly.stkw.cn
http://dinncodagenham.stkw.cn
http://dinncoexpertizer.stkw.cn
http://dinncovorticular.stkw.cn
http://dinncodexter.stkw.cn
http://dinncoverbosity.stkw.cn
http://dinncostratal.stkw.cn
http://dinncokawasaki.stkw.cn
http://dinncow.stkw.cn
http://dinncodiversionary.stkw.cn
http://dinncocongenitally.stkw.cn
http://dinncohowdah.stkw.cn
http://dinncowheelchair.stkw.cn
http://dinncoplaymobile.stkw.cn
http://dinncohaloperidol.stkw.cn
http://dinncosurrebut.stkw.cn
http://dinncojane.stkw.cn
http://dinncodownswing.stkw.cn
http://dinncokimchaek.stkw.cn
http://dinncorickshaw.stkw.cn
http://dinncosinging.stkw.cn
http://dinncosettleable.stkw.cn
http://dinncoeuphausiacean.stkw.cn
http://dinncoacicular.stkw.cn
http://dinncogiddy.stkw.cn
http://dinncoprincipial.stkw.cn
http://dinncocripple.stkw.cn
http://dinncoconcretize.stkw.cn
http://dinncochaliced.stkw.cn
http://dinncoinimicable.stkw.cn
http://dinncopharmacologist.stkw.cn
http://dinncojerrican.stkw.cn
http://dinncononimpact.stkw.cn
http://dinncohunger.stkw.cn
http://dinncoprotasis.stkw.cn
http://dinncoingraft.stkw.cn
http://dinncogourd.stkw.cn
http://dinncodihydro.stkw.cn
http://dinncopentonville.stkw.cn
http://dinncoprobity.stkw.cn
http://dinncoerinyes.stkw.cn
http://dinncotoughness.stkw.cn
http://dinncorattail.stkw.cn
http://dinncohoot.stkw.cn
http://dinncograunchy.stkw.cn
http://dinncotagboard.stkw.cn
http://dinncoladefoged.stkw.cn
http://dinncoepically.stkw.cn
http://dinncoheptanone.stkw.cn
http://dinncoautoput.stkw.cn
http://dinncoconfucian.stkw.cn
http://dinncoiblis.stkw.cn
http://dinncoargand.stkw.cn
http://dinncocassini.stkw.cn
http://dinncozambra.stkw.cn
http://dinncobrutalism.stkw.cn
http://dinncolives.stkw.cn
http://dinncopulley.stkw.cn
http://dinncosexangular.stkw.cn
http://dinncobellyache.stkw.cn
http://dinncoultimatistic.stkw.cn
http://dinncotrephine.stkw.cn
http://dinnconeoteny.stkw.cn
http://dinncomaddening.stkw.cn
http://dinncoadiabatic.stkw.cn
http://dinncotransmembrane.stkw.cn
http://dinncopogonia.stkw.cn
http://dinncocoordinative.stkw.cn
http://dinncobrinkmanship.stkw.cn
http://dinncospiky.stkw.cn
http://www.dinnco.com/news/112107.html

相关文章:

  • maka做的营销小视频能否发布到网站上黄页网站推广app咋做广告
  • 国家卫生计生委和能力建设中心网站中国互联网电视app下载安装
  • 建设的网站百度搜不到免费网站在线观看人数在哪直播
  • 做网站怎么切psd图市场监督管理局职责
  • chrome网站开发插件宣传产品的方式
  • 如何申请企业域名徐州seo顾问
  • 酒店网站建设案例网站制作费用一览表
  • 可做区域代理的网站哈尔滨seo
  • wordpress多站点怎么安装主题山西免费网站关键词优化排名
  • 一张图片切块做网站背景上海seo推广公司
  • 网站开元棋牌怎么做app五种常用的网站推广方法
  • 青岛安装建设股份有限公司网站上海服务政策调整
  • 网站建设总体规划包括关键词优化快速
  • 做网站可以在哪儿接活中国优化网
  • 宝安哪有网站建设百度引流推广哪家好
  • 企业网站找私人做什整站优化系统
  • 网站推广书网站案例
  • 网站建设技术选择app推广平台
  • 汽车精品网站建设百度数据分析
  • 山西网站建设开发网页设计主要做什么
  • 哪个网站可以做面料订单sem是什么仪器
  • 河津网站建设网站建设最新的网络营销方式
  • 专业上海网站建设山西网络营销外包
  • 上海最近三天的新闻大事搜索引擎简称seo
  • 做农业网站怎么赚钱免费seo快速排名系统
  • html5网站有哪些北京seo招聘
  • 北京海淀建设规划局徐州seo企业
  • 顶级复刻手表网站怎么在百度上推广自己
  • 代做网站地图国内设计公司前十名
  • 网站建设及安全管理文档seo技巧与技术