<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>
<script language="JavaScript" type="text/javascript">
</script><script language="JavaScript1.1" type="text/javascript">
</script><script language="JavaScript1.2" type="text/javascript">
</script><script language="JavaScript1.3" type="text/javascript">
</script><script language="JavaScript" type="text/javascript">
</script>
<script language="JavaScript" src="iBatis SQL Maps 2.0_files/163.htm" type="text/javascript"></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
|
|
2004/12/24
|
0.2.2
|
|
2004/10/12
|
0.2.0
|
|
2004/02/11
|
0.1.9
|
|
2004/01/16
|
0.1.8
|
|
2004/01/13
|
0.1.7
|
|
2004/01/09
|
0.1.6
|
|
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 ( |
...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> |
<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>