java的Generator接口在哪个包中?
首先非常抱歉,我还真不知道,但是我知会创建新的generator接口如下
安装
插件: help->install new sofeware 加入地址name:generator
location:http://mybatis.googlecode.com/svn/sub-projects/generator/trunk/eclipse/UpdateSite
配置文件
generatorConfig.xml
<?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> <!-- 驱动程序 --> <classPathEntry location="E:/workspace2/SmartSign20140326/WebContent/WEB-INF/lib/mysql-connector-java-5.1.28-bin.jar" /> <context id="context" targetRuntime="MyBatis3"> <!-- 注释 --> <commentGenerator> <property name="suppressAllComments" value="true" /> <property name="suppressDate" value="true" /> </commentGenerator> <!-- 数据库连接 --> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/SmartRoad" userId="root" password="root" /> <!--允许数值类型转换成不同类型,否则都映射为BigDecimal --> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- 模型文件 --> <javaModelGenerator targetPackage="cn.tiger.smartsign.entity" targetProject="SmartSign20140326/src"> <property name="enableSubPackages" value="false" /> <!-- 当为true时,产生的代码文件将按照schema产生子文件夹 --> <property name="trimStrings" value="true" /> <!-- set变量时自动剔除空白 --> </javaModelGenerator> <!-- XML映射文件 --> <sqlMapGenerator targetPackage="cn.tiger.smartsign.xml" targetProject="SmartSign20140326/src"> <property name="enableSubPackages" value="false" /> </sqlMapGenerator> <!-- DAO文件(mapper接口) --> <javaClientGenerator targetPackage="cn.tiger.smartsign.dao" targetProject="SmartSign20140326/src" type="XMLMAPPER"> <property name="enableSubPackages" value="false" /> </javaClientGenerator> <!-- 数据库表 --> <table schema="SmartRoad" tableName="users" domainObjectName="Users" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false" /> </table> </context> </generatorConfiguration>
说明:
生成实体类配置
<!-- 模型文件 --> <javaModelGenerator targetPackage="cn.tiger.smartsign.entity" targetProject="SmartSign20140326/src"> <property name="enableSubPackages" value="false" /> <!-- 当为true时,产生的代码文件将按照schema产生子文件夹 --> <property name="trimStrings" value="true" /> <!-- set变量时自动剔除空白 --> </javaModelGenerator>
生成映射器xml文件配置
<!-- 模型文件 --> <javaModelGenerator targetPackage="cn.tiger.smartsign.entity" targetProject="SmartSign20140326/src"> <property name="enableSubPackages" value="false" /> <!-- 当为true时,产生的代码文件将按照schema产生子文件夹 --> <property name="trimStrings" value="true" /> <!-- set变量时自动剔除空白 --> </javaModelGenerator>
生成mapper接口
<!-- XML映射文件 --> <sqlMapGenerator targetPackage="cn.tiger.smartsign.xml" targetProject="SmartSign20140326/src"> <property name="enableSubPackages" value="false" /> </sqlMapGenerator>
数据库表配置
<!-- 数据库表 --> <table schema="SmartRoad" tableName="users" domainObjectName="Users" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false" > <property name="useActualColumnNames" value="false" /> </table>
设置不生成Example类
enableCountByExample="false"
enableUpdateByExample="false"
enableDeleteByExample="false"
enableSelectByExample="false"
selectByExampleQueryId="false"
基本就这样,我只会这些了谢谢
Copyright © 广州京杭网络科技有限公司 2005-2025 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有