tgystc

0078

iBatis 工具


Google

<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
 

iBatis™ java-beans sources and sql-map config files generator

Генератор исходных текстов java-beans и sql-map конфигов для iBatis™

 

Date Version Changes
2005/10/31
0.2.3
Fixed some mysql specific issues.
2004/12/24
0.2.2
New parameters "nobeans" and "nomaps" are added. Processing of SQL definitions with multiple spaces is fixed
2004/10/12
0.2.0
SQL Maps 2.0 compatible.
2004/02/11
0.1.9
Parse of specific MySQL syntax is added. Fixed a lot of bugs.
2004/01/16
0.1.8
Changed order of statements in generated sql-map file. Added two new parameters "beansinc" and "mapsinc" for files containing user-defined code. Added mapped-statement for record deletion.
2004/01/13
0.1.7
Fixed some bugs. Added new parameters "beansout" and "mapsout". Now runs on *nix systems.
2004/01/09
0.1.6
First public release

 

Download. Ver. 0.2.3 for iBatis SQL Maps 2.0
Download. Ver. 0.1.91 for iBatis SQL Maps 1.X


iBatis java-beans sources and sql-map config files generator.
Version 0.2.3

USAGE: sql2iBatis.pl -input=<sqlfile> [OPTIONS]
    -input=<sqlfile>  sql-file to parse
OPTIONS are:
    -package=<packageName>    optional package name (domain.company.project)
    -force          forces files regeneration
    -beansout       java-beans output folder
    -mapsout        sql-maps output folder
    -mapsinc        Extension of file containing user-defined mapped statements
    -beansinc       Extension of file containing user-defined java-beans code

NOTE:   File with an extension specified using the parameter -beansinc (e.g. 'UserProperties.xml.inc')
    must be located in sql-maps output folder. It's content will be inserted right after the generated
    mapped-statements in the destination file.

Please send bug reports and feature requests to alxeg@yandex.ru

 

Giving following SQL file as input:

CREATE TABLE USER_PROPERTY (
USER_ID BIGINT NOT NULL
, FIRST_NAME VARCHAR(100) DEFAULT ''
, LAST_NAME VARCHAR(100)
, BIRTH_DATE TIMESTAMP(8)
, PRIMARY KEY (USER_ID)
);

...produces java-bean file:

package org.mystuff.db;


// WARNING: This is an autogenerated file


public class UserProperty {

    // Constructors
    public UserProperty() {
    }
    public UserProperty(long _userId) {
        this.userId = _userId;
    }

    // Fields
    private String firstName;
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String _firstName) {
        this.firstName = _firstName;
    }

    private java.util.Date birthDate;
    public java.util.Date getBirthDate() {
        return birthDate;
    }
    public void setBirthDate(java.util.Date _birthDate) {
        this.birthDate = _birthDate;
    }

    private String lastName;
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String _lastName) {
        this.lastName = _lastName;
    }

    private long userId;
    public long getUserId() {
        return userId;
    }
    public void setUserId(long _userId) {
        this.userId = _userId;
    }

}
    

...and iBatis sql-map config file:

<?xml version='1.0'?>

<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-2.dtd">


<!-- WARNING: This is an autogenerated file -->

<sqlMap name="UserProperty">

    <cacheModel id="userproperty-cache" type="MEMORY">
        <flushInterval hours="24"/>
        <flushOnExecute statement="insertUserProperty"/>
        <flushOnExecute statement="updateUserProperty"/>
        <flushOnExecute statement="deleteUserProperty"/>
        <property name="reference-type" value="WEAK" />
    </cacheModel>

    <resultMap class="org.mystuff.db.UserProperty" id="userproperty-result" >
        <result property="firstName" column="FIRST_NAME" />
        <result property="birthDate" column="BIRTH_DATE" />
        <result property="lastName" column="LAST_NAME" />
        <result property="userId" column="USER_ID" />
    </resultMap>

    <select id="getUserProperty" resultClass="org.mystuff.db.UserProperty" parameterClass="org.mystuff.db.UserProperty" resultMap="userproperty-result" >
        <![CDATA[
            select * from USER_PROPERTY
            where  USER_ID = #userId#
        ]]>
    </select>

    <update id="updateUserProperty" parameterClass="org.mystuff.db.UserProperty" >
        <![CDATA[
            update USER_PROPERTY
            set  FIRST_NAME = #firstName# ,  BIRTH_DATE = #birthDate# ,  LAST_NAME = #lastName#
            where  USER_ID = #userId#
        ]]>
    </update>

    <insert id="insertUserProperty" parameterClass="org.mystuff.db.UserProperty" >
        <![CDATA[
            insert into USER_PROPERTY(FIRST_NAME, BIRTH_DATE, LAST_NAME, USER_ID)
            values(#firstName#, #birthDate#, #lastName#, #userId#)
        ]]>
    </insert>

    <delete id="deleteUserProperty" parameterClass="org.mystuff.db.UserProperty"  >
        <![CDATA[
            delete  from USER_PROPERTY
            where  USER_ID = #userId#
        ]]>
    </delete>

</sqlMap>
 

 

Рейтинг@Mail.ru
 

<script type="text/javascript"> google_ad_client = "pub-5033576919944123"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text_image"; //2007-10-24: csdn.blog google_ad_channel = "8548491739"; </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
个人分类: ibatis java
想对作者说点什么? 我来说一句

ibatis的SqlMap辅助生成工具

2014年04月21日 11.42MB 下载

ibatis代码自动生成工具项目

2015年08月29日 1.88MB 下载

ibatis.net相应文件生成工具

2013年05月24日 5.8MB 下载

ibatis自动生成工具

2013年08月12日 6.83MB 下载

ibatis代码自动生成代码程序

2014年02月25日 246KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭