ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r833772 [12/25] - in /ibatis/java/ibator/trunk/core: ./ ibator-core/doc/ ibator-core/doc/html/ ibator-core/doc/html/configreference/ ibator-core/doc/html/generatedobjects/ ibator-core/doc/html/reference/ ibator-core/doc/html/usage/ ibator-m...
Date Sat, 07 Nov 2009 22:59:05 GMT
Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstName.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstName.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstName.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstName.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,55 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package ibatortest.execute.miscellaneous;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class FirstName {
+
+    private String value;
+    
+    /**
+     * 
+     */
+    public FirstName() {
+        super();
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    @Override
+    public boolean equals(Object arg0) {
+        if (arg0 == null) {
+            return false;
+        }
+        
+        return value.equals(((FirstName)arg0).getValue());
+    }
+
+    @Override
+    public int hashCode() {
+        return value == null ? 0 : value.hashCode();
+    }
+
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstNameTypeHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstNameTypeHandler.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstNameTypeHandler.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/FirstNameTypeHandler.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,71 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package ibatortest.execute.miscellaneous;
+
+import java.sql.SQLException;
+import java.sql.Types;
+
+import com.ibatis.sqlmap.client.extensions.ParameterSetter;
+import com.ibatis.sqlmap.client.extensions.ResultGetter;
+import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class FirstNameTypeHandler implements TypeHandlerCallback {
+
+    /**
+     * 
+     */
+    public FirstNameTypeHandler() {
+        super();
+    }
+
+    /* (non-Javadoc)
+     * @see com.ibatis.sqlmap.client.extensions.TypeHandlerCallback#setParameter(com.ibatis.sqlmap.client.extensions.ParameterSetter,
java.lang.Object)
+     */
+    public void setParameter(ParameterSetter arg0, Object arg1)
+            throws SQLException {
+        if (arg1 == null) {
+            arg0.setNull(Types.VARCHAR);
+        } else {
+            arg0.setString(((FirstName) arg1).getValue());
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see com.ibatis.sqlmap.client.extensions.TypeHandlerCallback#getResult(com.ibatis.sqlmap.client.extensions.ResultGetter)
+     */
+    public Object getResult(ResultGetter arg0) throws SQLException {
+        return valueOf(arg0.getString());
+    }
+
+    /* (non-Javadoc)
+     * @see com.ibatis.sqlmap.client.extensions.TypeHandlerCallback#valueOf(java.lang.String)
+     */
+    public Object valueOf(String arg0) {
+        if (arg0 == null) {
+            return null;
+        } else {
+            FirstName answer = new FirstName();
+            answer.setValue(arg0);
+            return answer;
+        }
+    }
+
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTime.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTime.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTime.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTime.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,77 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package ibatortest.execute.miscellaneous;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public class MyTime {
+    private int hours;
+    private int minutes;
+    private int seconds;
+
+    /**
+     * 
+     */
+    public MyTime() {
+        super();
+    }
+
+    public int getHours() {
+        return hours;
+    }
+
+    public void setHours(int hours) {
+        this.hours = hours;
+    }
+
+    public int getMinutes() {
+        return minutes;
+    }
+
+    public void setMinutes(int minutes) {
+        this.minutes = minutes;
+    }
+
+    public int getSeconds() {
+        return seconds;
+    }
+
+    public void setSeconds(int seconds) {
+        this.seconds = seconds;
+    }
+
+    @Override
+    public boolean equals(Object arg0) {
+        if (arg0 == null) {
+            return false;
+        }
+        
+        MyTime other = (MyTime) arg0;
+        
+        return this.hours == other.hours
+            && this.minutes == other.minutes
+            && this.seconds == other.seconds;
+    }
+
+    @Override
+    public int hashCode() {
+        return hours + minutes + seconds;
+    }
+
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTimeTypeHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTimeTypeHandler.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTimeTypeHandler.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/java/ibatortest/execute/miscellaneous/MyTimeTypeHandler.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,81 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package ibatortest.execute.miscellaneous;
+
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Types;
+import java.util.Calendar;
+
+import com.ibatis.sqlmap.client.extensions.ParameterSetter;
+import com.ibatis.sqlmap.client.extensions.ResultGetter;
+import com.ibatis.sqlmap.client.extensions.TypeHandlerCallback;
+
+/**
+ * @author Jeff Butler
+ * 
+ */
+public class MyTimeTypeHandler implements TypeHandlerCallback {
+
+    /**
+     * 
+     */
+    public MyTimeTypeHandler() {
+        super();
+    }
+
+    public Object getResult(ResultGetter resultGetter) throws SQLException {
+        Time time = resultGetter.getTime();
+        if (time == null) {
+            return null;
+        } else {
+
+            MyTime answer = new MyTime();
+
+            Calendar c = Calendar.getInstance();
+            c.setTime(time);
+
+            answer.setHours(c.get(Calendar.HOUR_OF_DAY));
+            answer.setMinutes(c.get(Calendar.MINUTE));
+            answer.setSeconds(c.get(Calendar.SECOND));
+
+            return answer;
+        }
+    }
+
+    public void setParameter(ParameterSetter parameterSetter, Object value)
+            throws SQLException {
+        if (value == null) {
+            parameterSetter.setNull(Types.TIME);
+        } else {
+            MyTime myTime = (MyTime) value;
+
+            Calendar c = Calendar.getInstance();
+            c.set(Calendar.HOUR_OF_DAY, myTime.getHours());
+            c.set(Calendar.MINUTE, myTime.getMinutes());
+            c.set(Calendar.SECOND, myTime.getSeconds());
+
+            Time time = new Time(c.getTime().getTime());
+
+            parameterSetter.setTime(time);
+        }
+    }
+
+    public Object valueOf(String arg0) {
+        return arg0;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/CreateDB.sql
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/CreateDB.sql?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/CreateDB.sql
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/CreateDB.sql
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,106 @@
+drop table FieldsOnly if exists;
+drop table PKOnly if exists;
+drop table PKFields if exists;
+drop table PKBlobs if exists;
+drop table PKFieldsBlobs if exists;
+drop table FieldsBlobs if exists;
+drop table "awful table" if exists;
+drop table BlobsOnly if exists;
+drop table RegexRename if exists;
+drop table AnotherAwfulTable if exists;
+
+create table FieldsOnly (
+  IntegerField int,
+  DoubleField double,
+  FloatField float
+);
+
+create table PKOnly (
+  id int not null,
+  seq_num int not null,
+  primary key(id, seq_num)
+);
+
+create table PKFields (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  dateField date,
+  timeField time,
+  timestampField timestamp,
+  decimal30Field decimal(3, 0),
+  decimal60Field decimal(6, 0),
+  decimal100Field decimal(10, 0),
+  decimal155Field decimal(15, 5),
+  wierd$Field int,
+  "birth date" date,
+  primary key (id1, id2)
+);
+
+create table PKBlobs (
+  id int not null,
+  blob1 longvarbinary,
+  blob2 longvarbinary,
+  primary key (id)
+);
+
+create table PKFieldsBlobs (
+  id1 int not null,
+  id2 int not null,
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  primary key (id1, id2)
+);
+
+create table FieldsBlobs (
+  firstName varchar(20),
+  lastName varchar(20),
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);
+
+create table "awful table" (
+  "CuStOmEr iD" int generated by default as identity (start with 57) not null,
+  "customer id" int,
+  "first name" varchar(20) default 'Mabel',
+  "First Name" varchar(20),
+  "first Name" varchar(20),
+  first_name varchar(20),
+  firstName varchar(20),
+  "last name" varchar(20),
+  E_MAIL varchar(20),
+  _id1 int not null,
+  $id2 int not null,
+  id5_ int not null,
+  id6$ int not null,
+  id7$$ int not null,
+  EmailAddress varchar(30),
+  "from" varchar(30),
+  active bit not null,
+  primary key("CuStOmEr iD")
+);
+
+-- this table should be ignored, nothing generated
+create table BlobsOnly (
+  blob1 longvarbinary,
+  blob2 longvarbinary
+);
+
+create table RegexRename (
+  CUST_ID integer,
+  CUST_NAME varchar(30),
+  CUST_ADDRESS varchar(30),
+  ZIP_CODE char(5),
+  primary key(CUST_ID)
+);
+
+create table AnotherAwfulTable (
+  id int not null,
+  "select" varchar(30),
+  "insert" varchar(30),
+  "update" varchar(30),
+  "delete" varchar(30),
+  primary key(id)
+);

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/ibatorConfig.xml
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/ibatorConfig.xml?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/ibatorConfig.xml
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/main/resources/ibatorConfig.xml
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,324 @@
+<?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>
+  <ibatorContext id="FlatJava5" targetRuntime="Ibatis2Java5" defaultModelType="flat">
+    <property name="suppressTypeWarnings" value="true" /> <!-- should be ignored
-->
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SqlMapConfigPlugin" >
+      <property name="targetPackage" value="ibatortest.generated.flat" />
+      <property name="targetProject" value="${generated.source.dir.java5}" />
+    </ibatorPlugin>
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.flat.java5.model" targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.flat.java5.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.flat.java5.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="FlatJava2" targetRuntime="Ibatis2Java2" defaultModelType="flat">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.flat.java2.model" targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.flat.java2.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="ibatortest.generated.flat.java2.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="HierarchicalJava5" targetRuntime="Ibatis2Java5" defaultModelType="hierarchical">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.hierarchical.java5.model"
targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.hierarchical.java5.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="ibatortest.generated.hierarchical.java5.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="HierarchicalJava2" targetRuntime="Ibatis2Java2" defaultModelType="hierarchical">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.hierarchical.java2.model"
targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.hierarchical.java2.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.hierarchical.java2.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="ConditionalJava5" targetRuntime="Ibatis2Java5" defaultModelType="conditional">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SerializablePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.conditional.java5.model" targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.conditional.java5.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="ibatortest.generated.conditional.java5.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="ConditionalJava2" targetRuntime="Ibatis2Java2" defaultModelType="conditional">
+    <property name="suppressTypeWarnings" value="true" />
+    
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.conditional.java2.model" targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.conditional.java2.xml"  targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="ibatortest.generated.conditional.java2.dao"
 targetProject="${generated.source.dir.java5}">
+      <property name="enableSubPackages" value="true" />
+    </daoGenerator>
+
+    <table tableName="FieldsOnly" />
+    <table tableName="PKOnly" />
+    <table tableName="PKFields" alias="B" />
+    <table tableName="PKBlobs" />
+    <table tableName="PKFieldsBlobs" />
+    <table tableName="FieldsBlobs" />
+    <table tableName="awful table" alias="A">
+      <property name="useColumnIndexes" value="true"/>
+      <generatedKey column="CuStOmEr iD" sqlStatement="HSQLDB" identity="true" />
+      <columnOverride column="customer id" property="secondCustomerId" />
+      <columnOverride column="first name" property="firstFirstName" />
+      <columnOverride column="First Name" property="secondFirstName" />
+      <ignoreColumn column="first Name" />
+      <columnOverride column="first_name" property="thirdFirstName" />
+      <columnOverride column="firstName" property="fourthFirstName" />
+      <columnOverride column="from" delimitedColumnName="true" />
+      <columnOverride column="active" javaType="boolean" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="miscellaneousTests" targetRuntime="Ibatis2Java5">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.CaseInsensitiveLikePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.RenameExampleClassPlugin" >
+      <property name="searchString" value="Example$"/>
+      <property name="replaceString" value="Criteria"/>
+    </ibatorPlugin>
+
+    <commentGenerator>
+      <property name="suppressDate" value="true"/>
+    </commentGenerator>
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.miscellaneous.model" targetProject="${generated.source.dir.java5}">
+      <property name="trimStrings" value="true" />
+      <property name="rootClass" value="ibatortest.execute.miscellaneous.BaseClass" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.miscellaneous.xml"  targetProject="${generated.source.dir.java5}">
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.generated.miscellaneous.dao"
 targetProject="${generated.source.dir.java5}"
+        implementationPackage="ibatortest.generated.miscellaneous.dao.impl">
+      <property name="rootInterface" value="ibatortest.execute.miscellaneous.BaseInterface"
/>
+      <property name="methodNameCalculator" value="EXTENDED"/>
+    </daoGenerator>
+
+    <table tableName="BlobsOnly" /> <!-- should generate a warning -->
+    <table tableName="NonExistantTable" /> <!-- should generate a warning -->
+    <table tableName="PKFields" domainObjectName="MyObject" alias="A" >
+      <ignoreColumn column="fred" /> <!-- should generate a warning -->
+      <ignoreColumn column="decimal30Field" />
+      <columnOverride column="datefield" property="startDate"/>
+      <columnOverride column="decimal155Field" javaType="java.lang.Double" />
+      <columnOverride column="decimal60Field" javaType="int" />
+      <columnOverride column="firstName" javaType="ibatortest.execute.miscellaneous.FirstName"
+         typeHandler="ibatortest.execute.miscellaneous.FirstNameTypeHandler"/>
+      <columnOverride column="timeField" javaType="ibatortest.execute.miscellaneous.MyTime"
+         typeHandler="ibatortest.execute.miscellaneous.MyTimeTypeHandler"/>
+    </table>
+    <table tableName="RegexRename">
+      <columnRenamingRule searchString="^CUST" />
+    </table>
+  </ibatorContext>
+
+  <ibatorContext id="miscellaneousTests_NoDAO" targetRuntime="Ibatis2Java5">
+    <property name="autoDelimitKeywords" value="true" />
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.generated.miscellaneous.model" targetProject="${generated.source.dir.java5}">
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.generated.miscellaneous.xml"
+                     targetProject="${generated.source.dir.java5}"/>
+
+    <table tableName="AnotherAwfulTable" />
+  </ibatorContext>
+</ibatorConfiguration>

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/AbstractTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/AbstractTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/AbstractTest.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/AbstractTest.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,138 @@
+/*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package ibatortest;
+
+import java.io.Reader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Properties;
+import java.util.Random;
+
+import junit.framework.TestCase;
+
+import com.ibatis.common.jdbc.ScriptRunner;
+import com.ibatis.common.resources.Resources;
+import com.ibatis.sqlmap.client.SqlMapClient;
+import com.ibatis.sqlmap.client.SqlMapClientBuilder;
+
+/**
+ * @author Jeff Butler
+ *
+ */
+public abstract class AbstractTest extends TestCase {
+
+    private SqlMapClient sqlMapClient;
+    private static DateFormat dateOnlyFormat = SimpleDateFormat.getDateInstance();
+    private static DateFormat timeOnlyFormat = SimpleDateFormat.getTimeInstance();
+
+    protected void initSqlMapClient(String configFile, Properties props) throws Exception
{
+        Reader reader = Resources.getResourceAsReader(configFile);
+        sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader, props);
+        reader.close();
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        Connection conn = null;
+
+        try {
+            Class.forName("org.hsqldb.jdbcDriver");
+            conn = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa",
+                    "");
+
+            Reader reader = Resources.getResourceAsReader("CreateDB.sql");
+
+            ScriptRunner runner = new ScriptRunner(conn, true, false);
+            runner.setLogWriter(null);
+            runner.setErrorLogWriter(null);
+            runner.runScript(reader);
+            conn.commit();
+
+            reader.close();
+        } finally {
+            if (conn != null) {
+                conn.close();
+            }
+        }
+    }
+
+    protected byte[] generateRandomBlob() {
+        Random random = new Random(System.currentTimeMillis());
+        
+        byte[] answer = new byte[256];
+        
+        random.nextBytes(answer);
+        
+        return answer;
+    }
+
+    protected boolean blobsAreEqual(byte[] blob1, byte[] blob2) {
+        if (blob1 == null) {
+            return blob2 == null;
+        }
+        
+        if (blob2 == null) {
+            return blob1 == null;
+        }
+        
+        boolean rc = blob1.length == blob2.length;
+        
+        if (rc) {
+            for (int i = 0; i < blob1.length; i++) {
+                if (blob1[i] != blob2[i]) {
+                    rc = false;
+                    break;
+                }
+            }
+        }
+        
+        return rc;
+    }
+    
+    protected boolean datesAreEqual(Date date1, Date date2) {
+        if (date1 == null) {
+            return date2 == null;
+        }
+        
+        if (date2 == null) {
+            return date1 == null;
+        }
+        
+        return dateOnlyFormat.format(date1).equals(dateOnlyFormat.format(date2));
+        
+    }
+    
+    protected boolean timesAreEqual(Date date1, Date date2) {
+        if (date1 == null) {
+            return date2 == null;
+        }
+        
+        if (date2 == null) {
+            return date1 == null;
+        }
+        
+        return timeOnlyFormat.format(date1).equals(timeOnlyFormat.format(date2));
+        
+    }
+
+    protected SqlMapClient getSqlMapClient() {
+        return sqlMapClient;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/AbstractConditionalJava2Test.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/AbstractConditionalJava2Test.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/AbstractConditionalJava2Test.java
(added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java5/src/test/java/ibatortest/execute/conditional/java2/AbstractConditionalJava2Test.java
Sat Nov  7 22:59:00 2009
@@ -0,0 +1,64 @@
+package ibatortest.execute.conditional.java2;
+
+import ibatortest.AbstractTest;
+import ibatortest.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.generated.conditional.java2.dao.FieldsblobsDAO;
+import ibatortest.generated.conditional.java2.dao.FieldsonlyDAO;
+import ibatortest.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.generated.conditional.java2.dao.PkonlyDAO;
+
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+public abstract class AbstractConditionalJava2Test extends AbstractTest {
+    
+    private BeanFactory factory;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+    
+    public AbstractConditionalJava2Test() {
+        Resource res = new ClassPathResource("/ibatortest/execute/conditional/java2/SpringBeans.xml");
+        factory = new XmlBeanFactory(res);
+    }
+
+    protected FieldsonlyDAO getFieldsonlyDAO() {
+        FieldsonlyDAO dao = (FieldsonlyDAO) factory.getBean("FieldsonlyDAO");
+        return dao;
+    }
+    
+    protected PkonlyDAO getPkonlyDAO() {
+        PkonlyDAO dao = (PkonlyDAO) factory.getBean("PkonlyDAO");
+        return dao;
+    }
+
+    protected PkfieldsDAO getPkfieldsDAO() {
+        PkfieldsDAO dao = (PkfieldsDAO) factory.getBean("PkfieldsDAO");
+        return dao;
+    }
+
+    protected PkblobsDAO getPkblobsDAO() {
+        PkblobsDAO dao = (PkblobsDAO) factory.getBean("PkblobsDAO");
+        return dao;
+    }
+
+    protected PkfieldsblobsDAO getPkfieldsblobsDAO() {
+        PkfieldsblobsDAO dao = (PkfieldsblobsDAO) factory.getBean("PkfieldsblobsDAO");
+        return dao;
+    }
+
+    protected FieldsblobsDAO getFieldsblobsDAO() {
+        FieldsblobsDAO dao = (FieldsblobsDAO) factory.getBean("FieldsblobsDAO");
+        return dao;
+    }
+
+    protected AwfulTableDAO getAwfulTableDAO() {
+        AwfulTableDAO dao = (AwfulTableDAO) factory.getBean("AwfulTableDAO");
+        return dao;
+    }
+}



Mime
View raw message