- 浏览: 291865 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
bglmmz:
zhangmingming_zmm001 写道我改成这个样子了 ...
mybatis 插入时返回刚插入记录的主键值 -
Bll:
怎么刷新了项目之后,搜索还是出现这个错误……
全局搜索的时候报错problems encountered during text search -
三市白衣:
Select Substring(@S1,CHARINDEX( ...
oracle substr、instr -
vem:
thanks,原来这么简单就可以。。。。
全局搜索的时候报错problems encountered during text search -
tianbrave:
谢谢!
myeclipse 中相同变量,高亮显示
转自:http://lj-zhu.iteye.com/blog/732325
修改ibator1.2.2(http://svn.apache.org/repos/asf/ibatis/java/ibator)
1) 修改org.apache.ibatis.ibator.api.Ibator类,
方法private void writeFile(File file, String content) throws IOException
修改编码如下:
- private void writeFile(File file, String content) throws IOException {
- java.io.OutputStreamWriter fos = new java.io.OutputStreamWriter(new java.io.FileOutputStream(file), "UTF-8");
- fos.write(content);
- fos.flush();
- fos.close();
- }
private void writeFile(File file, String content) throws IOException { java.io.OutputStreamWriter fos = new java.io.OutputStreamWriter(new java.io.FileOutputStream(file), "UTF-8"); fos.write(content); fos.flush(); fos.close(); }
2)修改org.apache.ibatis.ibator.internal.DefaultCommentGenerator类中的addFieldComment,addClassComment,addGetterComment,addSetterComment,addGeneralMethodComment,addComment方法,修改成你想要的格式。
修改如下方法:
- public void addClassComment(InnerClass innerClass,
- IntrospectedTable introspectedTable) {
- addClassComment(innerClass, introspectedTable.getFullyQualifiedTable(), false);
- }
- public void addEnumComment(InnerEnum innerEnum,
- IntrospectedTable introspectedTable) {
- addEnumComment(innerEnum, introspectedTable.getFullyQualifiedTable());
- }
- public void addFieldComment(Field field,
- IntrospectedTable introspectedTable,
- IntrospectedColumn introspectedColumn) {
- addFieldComment(field, introspectedTable.getFullyQualifiedTable(),
- introspectedColumn.getRemarks());
- }
- public void addFieldComment(Field field, IntrospectedTable introspectedTable) {
- addFieldComment(field, introspectedTable.getFullyQualifiedTable());
- }
- public void addGeneralMethodComment(Method method,
- IntrospectedTable introspectedTable) {
- addGeneralMethodComment(method, introspectedTable.getFullyQualifiedTable());
- }
- public void addGetterComment(Method method,
- IntrospectedTable introspectedTable,
- IntrospectedColumn introspectedColumn) {
- addGetterComment(method, introspectedTable.getFullyQualifiedTable(),
- introspectedColumn.getRemarks());
- }
- public void addSetterComment(Method method,
- IntrospectedTable introspectedTable,
- IntrospectedColumn introspectedColumn) {
- addSetterComment(method, introspectedTable.getFullyQualifiedTable(),
- introspectedColumn.getRemarks());
- }
- public void addClassComment(InnerClass innerClass,
- IntrospectedTable introspectedTable, boolean markAsDoNotDelete) {
- addClassComment(innerClass, introspectedTable.getFullyQualifiedTable(), markAsDoNotDelete);
- }
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) { addClassComment(innerClass, introspectedTable.getFullyQualifiedTable(), false); } public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) { addEnumComment(innerEnum, introspectedTable.getFullyQualifiedTable()); } public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { addFieldComment(field, introspectedTable.getFullyQualifiedTable(), introspectedColumn.getRemarks()); } public void addFieldComment(Field field, IntrospectedTable introspectedTable) { addFieldComment(field, introspectedTable.getFullyQualifiedTable()); } public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) { addGeneralMethodComment(method, introspectedTable.getFullyQualifiedTable()); } public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { addGetterComment(method, introspectedTable.getFullyQualifiedTable(), introspectedColumn.getRemarks()); } public void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { addSetterComment(method, introspectedTable.getFullyQualifiedTable(), introspectedColumn.getRemarks()); } public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) { addClassComment(innerClass, introspectedTable.getFullyQualifiedTable(), markAsDoNotDelete); }
主要是把
introspectedColumn.getActualColumnName()
改成(利用数据库中的comment生成注释)
introspectedColumn.getRemarks()
3)修改好,把生成的jar文件:"ibator-core-1.2.2-SNAPSHOT.jar",改名为"ibator.jar",在安装了ibator插件的Eclipse中,覆盖eclipse\plugins\org.apache.ibatis.ibator.core_1.2.1下的jar文件
4)测试:
4.1) 数据库脚本:
- create table
- CREATE TABLE `brand` (
- `code` varchar(36) NOT NULL default '' COMMENT '代码',
- `logopath` varchar(80) default NULL COMMENT 'logo路径',
- `name` varchar(40) NOT NULL default '' COMMENT '名字',
- `visible` bit(1) NOT NULL COMMENT '是否可见',
- PRIMARY KEY (`code`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
- create table
- CREATE TABLE `employee` (
- `username` varchar(20) NOT NULL default '' COMMENT '用户名',
- `degree` varchar(10) default NULL COMMENT '等级',
- `email` varchar(50) default NULL COMMENT '电子邮箱',
- `gender` varchar(5) NOT NULL default '' COMMENT '性别',
- `imageName` varchar(41) default NULL COMMENT '图片名字',
- `password` varchar(20) NOT NULL default '' COMMENT '密码',
- `phone` varchar(20) default NULL COMMENT '电话',
- `realname` varchar(10) NOT NULL default '' COMMENT '真实姓名',
- `school` varchar(20) default NULL COMMENT '学校',
- `visible` bit(1) NOT NULL COMMENT '是否可见',
- `department_id` int(11) default NULL COMMENT '部门ID',
- `card_id` int(11) NOT NULL COMMENT '身份证',
- PRIMARY KEY (`username`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8
create table CREATE TABLE `brand` ( `code` varchar(36) NOT NULL default '' COMMENT '代码', `logopath` varchar(80) default NULL COMMENT 'logo路径', `name` varchar(40) NOT NULL default '' COMMENT '名字', `visible` bit(1) NOT NULL COMMENT '是否可见', PRIMARY KEY (`code`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 create table CREATE TABLE `employee` ( `username` varchar(20) NOT NULL default '' COMMENT '用户名', `degree` varchar(10) default NULL COMMENT '等级', `email` varchar(50) default NULL COMMENT '电子邮箱', `gender` varchar(5) NOT NULL default '' COMMENT '性别', `imageName` varchar(41) default NULL COMMENT '图片名字', `password` varchar(20) NOT NULL default '' COMMENT '密码', `phone` varchar(20) default NULL COMMENT '电话', `realname` varchar(10) NOT NULL default '' COMMENT '真实姓名', `school` varchar(20) default NULL COMMENT '学校', `visible` bit(1) NOT NULL COMMENT '是否可见', `department_id` int(11) default NULL COMMENT '部门ID', `card_id` int(11) NOT NULL COMMENT '身份证', PRIMARY KEY (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8
4.2)ibatorConfig.xml文件
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" > <ibatorConfiguration> <classPathEntry location="D:/Eclipse/workspace/helios-3.6/test/lib/mysql_connector_java_5.jar" /> <ibatorContext id="context1" targetRuntime="Ibatis2Java5"> <commentGenerator> <property name="suppressDate" value="true" /> </commentGenerator> <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/test" userId="root" password="root"> </jdbcConnection> <javaModelGenerator targetPackage="cn.zlj.ibatis.entity" targetProject="test" /> <sqlMapGenerator targetPackage="cn.zlj.ibatis.sqlmap" targetProject="test" /> <daoGenerator targetPackage="cn.zlj.ibatis.dao" targetProject="test" implementationPackage="cn.zlj.ibatis.dao.impl" type="spring" /> <table tableName="brand"> </table> <table tableName="employee"> </table> </ibatorContext> </ibatorConfiguration>
4.3)ibator生成文件
package cn.zlj.ibatis.entity; public class Brand { /** * 代码 */ private String code; /** * logo路径 */ private String logopath; /** * 名字 */ private String name; /** * 是否可见 */ private Boolean visible; /** * 获取 代码 * * @return */ public String getCode() { return code; } /** * 设置 代码 * * @param code */ public void setCode(String code) { this.code = code; } /** * 获取 logo路径 * * @return */ public String getLogopath() { return logopath; } /** * 设置 logo路径 * * @param logopath */ public void setLogopath(String logopath) { this.logopath = logopath; } /** * 获取 名字 * * @return */ public String getName() { return name; } /** * 设置 名字 * * @param name */ public void setName(String name) { this.name = name; } /** * 获取 是否可见 * * @return */ public Boolean getVisible() { return visible; } /** * 设置 是否可见 * * @param visible */ public void setVisible(Boolean visible) { this.visible = visible; } }
package cn.zlj.ibatis.entity; public class Employee { /** * 用户名 */ private String username; /** * 等级 */ private String degree; /** * 电子邮箱 */ private String email; /** * 性别 */ private String gender; /** * 图片名字 */ private String imagename; /** * 密码 */ private String password; /** * 电话 */ private String phone; /** * 真实姓名 */ private String realname; /** * 学校 */ private String school; /** * 是否可见 */ private Boolean visible; /** * 部门ID */ private Integer departmentId; /** * 身份证 */ private Integer cardId; /** * 获取 用户名 * * @return */ public String getUsername() { return username; } /** * 设置 用户名 * * @param username */ public void setUsername(String username) { this.username = username; } /** * 获取 等级 * * @return */ public String getDegree() { return degree; } /** * 设置 等级 * * @param degree */ public void setDegree(String degree) { this.degree = degree; } /** * 获取 电子邮箱 * * @return */ public String getEmail() { return email; } /** * 设置 电子邮箱 * * @param email */ public void setEmail(String email) { this.email = email; } /** * 获取 性别 * * @return */ public String getGender() { return gender; } /** * 设置 性别 * * @param gender */ public void setGender(String gender) { this.gender = gender; } /** * 获取 图片名字 * * @return */ public String getImagename() { return imagename; } /** * 设置 图片名字 * * @param imagename */ public void setImagename(String imagename) { this.imagename = imagename; } /** * 获取 密码 * * @return */ public String getPassword() { return password; } /** * 设置 密码 * * @param password */ public void setPassword(String password) { this.password = password; } /** * 获取 电话 * * @return */ public String getPhone() { return phone; } /** * 设置 电话 * * @param phone */ public void setPhone(String phone) { this.phone = phone; } /** * 获取 真实姓名 * * @return */ public String getRealname() { return realname; } /** * 设置 真实姓名 * * @param realname */ public void setRealname(String realname) { this.realname = realname; } /** * 获取 学校 * * @return */ public String getSchool() { return school; } /** * 设置 学校 * * @param school */ public void setSchool(String school) { this.school = school; } /** * 获取 是否可见 * * @return */ public Boolean getVisible() { return visible; } /** * 设置 是否可见 * * @param visible */ public void setVisible(Boolean visible) { this.visible = visible; } /** * 获取 部门ID * * @return */ public Integer getDepartmentId() { return departmentId; } /** * 设置 部门ID * * @param departmentId */ public void setDepartmentId(Integer departmentId) { this.departmentId = departmentId; } /** * 获取 身份证 * * @return */ public Integer getCardId() { return cardId; } /** * 设置 身份证 * * @param cardId */ public void setCardId(Integer cardId) { this.cardId = cardId; } }
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd" > <sqlMap namespace="brand" > <resultMap id="BaseResultMap" class="cn.zlj.ibatis.entity.Brand" > <result column="code" property="code" jdbcType="VARCHAR" /> <result column="logopath" property="logopath" jdbcType="VARCHAR" /> <result column="name" property="name" jdbcType="VARCHAR" /> <result column="visible" property="visible" jdbcType="BIT" /> </resultMap> <sql id="Example_Where_Clause" > <iterate property="oredCriteria" conjunction="or" prepend="where" removeFirstPrepend="iterate" > <isEqual property="oredCriteria[].valid" compareValue="true" > ( <iterate prepend="and" property="oredCriteria[].criteriaWithoutValue" conjunction="and" > $oredCriteria[].criteriaWithoutValue[]$ </iterate> <iterate prepend="and" property="oredCriteria[].criteriaWithSingleValue" conjunction="and" > $oredCriteria[].criteriaWithSingleValue[].condition$ #oredCriteria[].criteriaWithSingleValue[].value# </iterate> <iterate prepend="and" property="oredCriteria[].criteriaWithListValue" conjunction="and" > $oredCriteria[].criteriaWithListValue[].condition$ <iterate property="oredCriteria[].criteriaWithListValue[].values" open="(" close=")" conjunction="," > #oredCriteria[].criteriaWithListValue[].values[]# </iterate> </iterate> <iterate prepend="and" property="oredCriteria[].criteriaWithBetweenValue" conjunction="and" > $oredCriteria[].criteriaWithBetweenValue[].condition$ #oredCriteria[].criteriaWithBetweenValue[].values[0]# and #oredCriteria[].criteriaWithBetweenValue[].values[1]# </iterate> ) </isEqual> </iterate> </sql> <sql id="Base_Column_List" > code, logopath, name, visible </sql> <select id="selectByExample" resultMap="BaseResultMap" parameterClass="cn.zlj.ibatis.entity.BrandExample" > select <isParameterPresent > <isEqual property="distinct" compareValue="true" > distinct </isEqual> </isParameterPresent> <include refid="brand.Base_Column_List" /> from brand <isParameterPresent > <include refid="brand.Example_Where_Clause" /> <isNotNull property="orderByClause" > order by $orderByClause$ </isNotNull> </isParameterPresent> </select> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterClass="cn.zlj.ibatis.entity.Brand" > select <include refid="brand.Base_Column_List" /> from brand where code = #code:VARCHAR# </select> <delete id="deleteByPrimaryKey" parameterClass="cn.zlj.ibatis.entity.Brand" > delete from brand where code = #code:VARCHAR# </delete> <delete id="deleteByExample" parameterClass="cn.zlj.ibatis.entity.BrandExample" > delete from brand <include refid="brand.Example_Where_Clause" /> </delete> <insert id="insert" parameterClass="cn.zlj.ibatis.entity.Brand" > insert into brand (code, logopath, name, visible) values (#code:VARCHAR#, #logopath:VARCHAR#, #name:VARCHAR#, #visible:BIT#) </insert> <insert id="insertSelective" parameterClass="cn.zlj.ibatis.entity.Brand" > insert into brand <dynamic prepend="(" > <isNotNull prepend="," property="code" > code </isNotNull> <isNotNull prepend="," property="logopath" > logopath </isNotNull> <isNotNull prepend="," property="name" > name </isNotNull> <isNotNull prepend="," property="visible" > visible </isNotNull> ) </dynamic> values <dynamic prepend="(" > <isNotNull prepend="," property="code" > #code:VARCHAR# </isNotNull> <isNotNull prepend="," property="logopath" > #logopath:VARCHAR# </isNotNull> <isNotNull prepend="," property="name" > #name:VARCHAR# </isNotNull> <isNotNull prepend="," property="visible" > #visible:BIT# </isNotNull> ) </dynamic> </insert> <select id="countByExample" parameterClass="cn.zlj.ibatis.entity.BrandExample" resultClass="java.lang.Integer" > select count(*) from brand <include refid="brand.Example_Where_Clause" /> </select> <update id="updateByExampleSelective" > update brand <dynamic prepend="set" > <isNotNull prepend="," property="record.code" > code = #record.code:VARCHAR# </isNotNull> <isNotNull prepend="," property="record.logopath" > logopath = #record.logopath:VARCHAR# </isNotNull> <isNotNull prepend="," property="record.name" > name = #record.name:VARCHAR# </isNotNull> <isNotNull prepend="," property="record.visible" > visible = #record.visible:BIT# </isNotNull> </dynamic> <isParameterPresent > <include refid="brand.Example_Where_Clause" /> </isParameterPresent> </update> <update id="updateByExample" > update brand set code = #record.code:VARCHAR#, logopath = #record.logopath:VARCHAR#, name = #record.name:VARCHAR#, visible = #record.visible:BIT# <isParameterPresent > <include refid="brand.Example_Where_Clause" /> </isParameterPresent> </update> <update id="updateByPrimaryKeySelective" parameterClass="cn.zlj.ibatis.entity.Brand" > update brand <dynamic prepend="set" > <isNotNull prepend="," property="logopath" > logopath = #logopath:VARCHAR# </isNotNull> <isNotNull prepend="," property="name" > name = #name:VARCHAR# </isNotNull> <isNotNull prepend="," property="visible" > visible = #visible:BIT# </isNotNull> </dynamic> where code = #code:VARCHAR# </update> <update id="updateByPrimaryKey" parameterClass="cn.zlj.ibatis.entity.Brand" > update brand set logopath = #logopath:VARCHAR#, name = #name:VARCHAR#, visible = #visible:BIT# where code = #code:VARCHAR# </update> </sqlMap>
package cn.zlj.ibatis.dao; import cn.zlj.ibatis.entity.Brand; import cn.zlj.ibatis.entity.BrandExample; import java.util.List; public interface BrandDAO { /** * brand countByExample */ int countByExample(BrandExample example); /** * brand deleteByExample */ int deleteByExample(BrandExample example); /** * brand deleteByPrimaryKey */ int deleteByPrimaryKey(String code); /** * brand insert */ void insert(Brand record); /** * brand insertSelective */ void insertSelective(Brand record); /** * brand selectByExample */ List<Brand> selectByExample(BrandExample example); /** * brand selectByPrimaryKey */ Brand selectByPrimaryKey(String code); /** * brand updateByExampleSelective */ int updateByExampleSelective(Brand record, BrandExample example); /** * brand updateByExample */ int updateByExample(Brand record, BrandExample example); /** * brand updateByPrimaryKeySelective */ int updateByPrimaryKeySelective(Brand record); /** * brand updateByPrimaryKey */ int updateByPrimaryKey(Brand record); }
package cn.zlj.ibatis.dao.impl; import cn.zlj.ibatis.dao.BrandDAO; import cn.zlj.ibatis.entity.Brand; import cn.zlj.ibatis.entity.BrandExample; import java.util.List; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; public class BrandDAOImpl extends SqlMapClientDaoSupport implements BrandDAO { /** * brand BrandDAOImpl */ public BrandDAOImpl() { super(); } /** * brand countByExample */ public int countByExample(BrandExample example) { Integer count = (Integer) getSqlMapClientTemplate().queryForObject("brand.countByExample", example); return count; } /** * brand deleteByExample */ public int deleteByExample(BrandExample example) { int rows = getSqlMapClientTemplate().delete("brand.deleteByExample", example); return rows; } /** * brand deleteByPrimaryKey */ public int deleteByPrimaryKey(String code) { Brand _key = new Brand(); _key.setCode(code); int rows = getSqlMapClientTemplate().delete("brand.deleteByPrimaryKey", _key); return rows; } /** * brand insert */ public void insert(Brand record) { getSqlMapClientTemplate().insert("brand.insert", record); } /** * brand insertSelective */ public void insertSelective(Brand record) { getSqlMapClientTemplate().insert("brand.insertSelective", record); } /** * brand selectByExample */ @SuppressWarnings("unchecked") public List<Brand> selectByExample(BrandExample example) { List<Brand> list = getSqlMapClientTemplate().queryForList("brand.selectByExample", example); return list; } /** * brand selectByPrimaryKey */ public Brand selectByPrimaryKey(String code) { Brand _key = new Brand(); _key.setCode(code); Brand record = (Brand) getSqlMapClientTemplate().queryForObject("brand.selectByPrimaryKey", _key); return record; } /** * brand updateByExampleSelective */ public int updateByExampleSelective(Brand record, BrandExample example) { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update("brand.updateByExampleSelective", parms); return rows; } /** * brand updateByExample */ public int updateByExample(Brand record, BrandExample example) { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update("brand.updateByExample", parms); return rows; } /** * brand updateByPrimaryKeySelective */ public int updateByPrimaryKeySelective(Brand record) { int rows = getSqlMapClientTemplate().update("brand.updateByPrimaryKeySelective", record); return rows; } /** * brand updateByPrimaryKey */ public int updateByPrimaryKey(Brand record) { int rows = getSqlMapClientTemplate().update("brand.updateByPrimaryKey", record); return rows; } /** * brand */ protected static class UpdateByExampleParms extends BrandExample { private Object record; public UpdateByExampleParms(Object record, BrandExample example) { super(example); this.record = record; } public Object getRecord() { return record; } } }
OK,修改完成,去掉了很多原来自动生成的注释。
可以自己写实现org.apache.ibatis.ibator.api.CommentGenerato 或者重写org.apache.ibatis.ibator.internal.DefaultCommentGenerator这个类的
public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable) public void addEnumComment(InnerEnum innerEnum, IntrospectedTable introspectedTable) public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) public void addFieldComment(Field field, IntrospectedTable introspectedTable); public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) ; public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) ; public void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) ; public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) ; ibator1.2.2与以前的版本的主要改变就是以上这几个方法,原来的这种 addFieldComment(Field field, FullyQualifiedTable table, String columnName)方法, 在下一版本中就会被去掉了。
|
发表评论
-
mybatis sql 注意事项
2017-09-12 21:30 4451、like查询 like CONCAT('%',#{na ... -
Mybatis Generator生成数据库自带的中文注释(转载)
2017-09-11 21:23 42831、相关jar包 <!-- mybatis生成 ... -
Ibator 的使用
2011-09-06 22:32 1104http://people.apache.org/builds ... -
eclipse 安装 Ibator 插件
2011-09-06 20:25 8021、Help->Install New Software ... -
mybatis 插入时返回刚插入记录的主键值
2011-08-31 12:02 31615<insert id="insert" ... -
mybatis的使用之jdbcType
2011-05-16 13:49 4173在insert的时候对于一些数据库中可以为空的值要指定jdbc ...
相关推荐
【IBATOR动态生成SQL和DAO层】是一种高效开发工具,基于Apache的iBatis框架,旨在简化数据库操作的代码编写工作。iBatis是Java语言中的一个持久层框架,它允许开发者将SQL语句直接嵌入到Java代码中,提供灵活的数据...
ibator1.2.2多了点功能,具体可以百度,重新编译了下,生成注释去掉了
"ibatis:使用ibator自动生成代码和配置文件"这个主题聚焦于一个实用的工具——ibator,它是MyBatis框架的一个扩展,用于自动化MyBatis的代码生成过程。这篇文章将深入探讨ibator的工作原理、如何安装和配置,以及它...
使用数据库的注释,不用自带的注释 http://blog.csdn.net/tiantangpw/article/details/43489817 运行命令 java -jar ibator.jar -configfile ibatorConfig.xml -overwrite >>ibator.log
开源ibator什么xml和pojo的时候,经常会带一些讨厌的注释还有一些没用的ibatorgenerator等的,我改了它的源代码,弄了个干净的ibator
Ibator 1.2.1是其一个稳定版本,包含了多项改进和优化,使得代码生成更加智能化,更易于集成到项目中。 二、Ibator 1.2.1主要功能 1. 数据库表扫描:Ibator可以自动扫描数据库中的表,根据表结构生成相应的Java...
标题 "ibatis自动生成工具ibator及配置文件示例" 提到的是关于iBatis的自动化工具ibator的使用和配置。iBatis是一个优秀的Java持久层框架,它允许开发者将SQL语句直接写在XML配置文件中,使得数据库操作与业务逻辑...
Ibator是iBATIS(现在已经演变为MyBatis)的一个扩展,它能够根据数据库表结构自动生成Java源代码,包括DTO(Data Transfer Objects)、DAO(Data Access Object)类以及对应的XML映射文件,大大减少了手动编写这些...
Ibator is a code generator for iBATIS. Ibator will introspect a database table (or many tables) and will generate iBATIS artifacts that can be used to access the table(s). This abates some of the ...
ibatorConfig.xml的注释提供了详细的配置选项说明,包括数据库连接信息、生成代码的包结构、生成的类是否包含Javadoc等。通过灵活调整这些配置,开发者可以定制化Ibator生成的代码样式和结构,使其更符合项目规范。 ...
Ibator,全称“Introspected Table Abstraction”,是Apache MyBatis框架的一个子项目,它提供了一个代码生成器,能够自动生成JavaBean、Mapper接口和XML配置文件,大大减少了开发者手动编写这些重复代码的工作量。...
Ibator支持多种自定义配置,例如可以设置生成的Java类的包名、是否生成注释、字段命名规则等。这些配置使得生成的代码更符合项目规范,避免手动修改大量代码。此外,Ibator还支持逆向工程,即根据已有的Java类和...
iBATOR,全称为"IBATIS Auto Table Access Toolkit Generator",是针对iBATIS数据库持久层框架的一个代码生成工具。它的主要功能是自动生成与数据库表相关的Java代码,包括实体类、Mapper接口和XML配置文件,极大地...
- **设置生成策略**:定义生成的Java类和XML配置文件的命名规则、是否生成注释、字段映射等。 - **生成代码**:确认设置无误后,点击“Finish”生成代码。 生成的代码通常包括: - **实体类(Entity Class)**:...
此外,如果你不希望ibator生成的代码包含过多的注释,可以修改`DefaultCommentGenerator`类来去掉这些注释。这通常需要下载源码,修改后再重新打包成jar文件,替换Eclipse中的原版ibator插件。 总的来说,ibator是...
【ibator 1.2.1】是一款基于Eclipse的插件,用于自动化生成Ibatis框架的代码。这个工具极大地提升了开发效率,减少了手动编写SQL映射文件、实体类和DAO层代码的工作量。它的核心功能是根据数据库表结构自动生成Java...
"修改后jar"文件可能是指经过优化的Ibator核心库,这些库文件可能已经过修改,以支持插件的新特性或改进。 总的来说,Ibator-Eclipse插件1.2.1版是开发者提高工作效率、简化数据库操作的得力助手。它通过消除不必要...
5. **全局配置**:包括生成代码的编码格式、日期时间类型处理、是否生成注释等全局性设置。 6. **插件配置**:可以添加自定义的插件,例如逻辑删除插件,来实现特定的业务需求。 在Eclipse中使用ibator插件,首先...
Ibator自动生成的代码通常包含有详细的模板注释,这些注释提供了关于如何配置和使用生成的类的信息。然而,随着项目的进展,这些初始注释可能会变得过时或者冗余,这时就需要一个工具来批量删除或更新它们。 "删除...
IBator是Apache iBATIS项目的一个子项目,它是一个代码生成器,能够帮助开发人员自动化创建基于iBATIS的持久层代码,包括Java模型类、SQL映射文件以及DAO接口。通过减少手动编写这些常见的重复性工作,IBator可以...