ibatis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgbut...@apache.org
Subject svn commit: r833772 [5/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-ma...
Date Sat, 07 Nov 2009 22:59:05 GMT
Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/FirstNameTypeHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/FirstNameTypeHandler.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/FirstNameTypeHandler.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/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.java2.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-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTime.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTime.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTime.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTime.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,75 @@
+/*
+ *  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.java2.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;
+    }
+
+    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;
+    }
+
+    public int hashCode() {
+        return hours + minutes + seconds;
+    }
+
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTimeTypeHandler.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTimeTypeHandler.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/execute/miscellaneous/MyTimeTypeHandler.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/java/ibatortest/java2/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.java2.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-java2/src/main/resources/CreateDB.sql
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/CreateDB.sql?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/CreateDB.sql (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/CreateDB.sql Sat Nov  7 22:59:00 2009
@@ -0,0 +1,87 @@
+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;
+
+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
+);

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/ibatorConfig.xml
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/ibatorConfig.xml?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/ibatorConfig.xml (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/main/resources/ibatorConfig.xml Sat Nov  7 22:59:00 2009
@@ -0,0 +1,166 @@
+<?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="FlatJava2" targetRuntime="Ibatis2Java2" defaultModelType="flat">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.SqlMapConfigPlugin" >
+      <property name="targetPackage" value="ibatortest.java2.generated.flat" />
+      <property name="targetProject" value="${generated.source.dir.java2}" />
+    </ibatorPlugin>
+    
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.java2.generated.flat.java2.model" targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.java2.generated.flat.java2.xml"  targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-SI" targetPackage="ibatortest.java2.generated.flat.java2.dao"  targetProject="${generated.source.dir.java2}">
+      <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">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.java2.generated.hierarchical.java2.model" targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.java2.generated.hierarchical.java2.xml"  targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.java2.generated.hierarchical.java2.dao"  targetProject="${generated.source.dir.java2}">
+      <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">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.java2.generated.conditional.java2.model" targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+      <property name="trimStrings" value="true" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.java2.generated.conditional.java2.xml"  targetProject="${generated.source.dir.java2}">
+      <property name="enableSubPackages" value="true" />
+    </sqlMapGenerator>
+
+    <daoGenerator type="SPRING" targetPackage="ibatortest.java2.generated.conditional.java2.dao"  targetProject="${generated.source.dir.java2}">
+      <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="Ibatis2Java2">
+    <ibatorPlugin type="org.apache.ibatis.ibator.plugins.EqualsHashCodePlugin" />
+
+    <jdbcConnection driverClass="org.hsqldb.jdbcDriver"
+        connectionURL="jdbc:hsqldb:mem:aname"
+        userId="sa" />
+
+    <javaModelGenerator targetPackage="ibatortest.java2.generated.miscellaneous.model" targetProject="${generated.source.dir.java2}">
+      <property name="trimStrings" value="true" />
+      <property name="rootClass" value="ibatortest.java2.execute.miscellaneous.BaseClass" />
+    </javaModelGenerator>
+
+    <sqlMapGenerator targetPackage="ibatortest.java2.generated.miscellaneous.xml"  targetProject="${generated.source.dir.java2}">
+    </sqlMapGenerator>
+
+    <daoGenerator type="GENERIC-CI" targetPackage="ibatortest.java2.generated.miscellaneous.dao"  targetProject="${generated.source.dir.java2}">
+      <property name="rootInterface" value="ibatortest.java2.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.java2.execute.miscellaneous.FirstName"
+         typeHandler="ibatortest.java2.execute.miscellaneous.FirstNameTypeHandler"/>
+      <columnOverride column="timeField" javaType="ibatortest.java2.execute.miscellaneous.MyTime"
+         typeHandler="ibatortest.java2.execute.miscellaneous.MyTimeTypeHandler"/>
+    </table>
+  </ibatorContext>
+</ibatorConfiguration>

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/AbstractTest.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,136 @@
+/*
+ *  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.java2;
+
+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 com.ibatis.common.jdbc.ScriptRunner;
+import com.ibatis.common.resources.Resources;
+import com.ibatis.sqlmap.client.SqlMapClient;
+import com.ibatis.sqlmap.client.SqlMapClientBuilder;
+
+import junit.framework.TestCase;
+
+/**
+ * @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();
+    }
+
+    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-java2/src/test/java/ibatortest/java2/execute/conditional/java2/AbstractConditionalJava2Test.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/AbstractConditionalJava2Test.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/AbstractConditionalJava2Test.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/AbstractConditionalJava2Test.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,64 @@
+package ibatortest.java2.execute.conditional.java2;
+
+import ibatortest.java2.AbstractTest;
+import ibatortest.java2.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsonlyDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.java2.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/java2/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;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/ConditionalJava2TestSuite.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/ConditionalJava2TestSuite.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/ConditionalJava2TestSuite.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/ConditionalJava2TestSuite.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,42 @@
+/*
+ *  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.java2.execute.conditional.java2;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author Jeff Butler
+ * 
+ */
+public class ConditionalJava2TestSuite {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Conditional Java2 Tests");
+        
+        suite.addTestSuite(CountByExampleTest.class);
+        suite.addTestSuite(DeleteByExampleTest.class);
+        suite.addTestSuite(DeleteByPrimaryKeyTest.class);
+        suite.addTestSuite(InsertTest.class);
+        suite.addTestSuite(SelectByExampleTest.class);
+        suite.addTestSuite(SelectByPrimaryKeyTest.class);
+        suite.addTestSuite(UpdateByExampleTest.class);
+        suite.addTestSuite(UpdateByPrimaryKeyTest.class);
+
+        return suite;
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/CountByExampleTest.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,270 @@
+package ibatortest.java2.execute.conditional.java2;
+
+import ibatortest.java2.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsonlyDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkonlyDAO;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTable;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTableExample;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsWithBLOBs;
+import ibatortest.java2.generated.conditional.java2.model.Fieldsonly;
+import ibatortest.java2.generated.conditional.java2.model.FieldsonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfields;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+
+public class CountByExampleTest extends AbstractConditionalJava2Test {
+
+    public void testFieldsOnlyCountByExample() {
+        FieldsonlyDAO dao = getFieldsonlyDAO();
+    
+        try {
+            Fieldsonly record = new Fieldsonly();
+            record.setDoublefield(new Double(11.22));
+            record.setFloatfield(new Double(33.44));
+            record.setIntegerfield(new Integer(5));
+            dao.insert(record);
+    
+            record = new Fieldsonly();
+            record.setDoublefield(new Double(44.55));
+            record.setFloatfield(new Double(66.77));
+            record.setIntegerfield(new Integer(8));
+            dao.insert(record);
+    
+            record = new Fieldsonly();
+            record.setDoublefield(new Double(88.99));
+            record.setFloatfield(new Double(100.111));
+            record.setIntegerfield(new Integer(9));
+            dao.insert(record);
+    
+            FieldsonlyExample example = new FieldsonlyExample();
+            example.createCriteria().andIntegerfieldGreaterThan(new Integer(5));
+    
+            int rows = dao.countByExample(example);
+            assertEquals(2, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(3, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKOnlyCountByExample() {
+        PkonlyDAO dao = getPkonlyDAO();
+    
+        try {
+            PkonlyKey key = new PkonlyKey();
+            key.setId(new Integer(1));
+            key.setSeqNum(new Integer(3));
+            dao.insert(key);
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(5));
+            key.setSeqNum(new Integer(6));
+            dao.insert(key);
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(7));
+            key.setSeqNum(new Integer(8));
+            dao.insert(key);
+    
+            PkonlyExample example = new PkonlyExample();
+            example.createCriteria().andIdGreaterThan(new Integer(4));
+            int rows = dao.countByExample(example);
+            assertEquals(2, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(3, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsBlobsCountByExample() {
+        PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
+    
+        try {
+            Pkfieldsblobs record = new Pkfieldsblobs();
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new Pkfieldsblobs();
+            record.setId1(new Integer(5));
+            record.setId2(new Integer(6));
+            record.setFirstname("Scott");
+            record.setLastname("Jones");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            PkfieldsblobsExample example = new PkfieldsblobsExample();
+            example.createCriteria().andId1NotEqualTo(new Integer(3));
+            int rows = dao.countByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(2, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsCountByExample() {
+        PkfieldsDAO dao = getPkfieldsDAO();
+    
+        try {
+            Pkfields record = new Pkfields();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            dao.insert(record);
+    
+            record = new Pkfields();
+            record.setFirstname("Bob");
+            record.setLastname("Jones");
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+    
+            dao.insert(record);
+    
+            PkfieldsExample example = new PkfieldsExample();
+            example.createCriteria().andLastnameLike("J%");
+            int rows = dao.countByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(2, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKBlobsCountByExample() {
+        PkblobsDAO dao = getPkblobsDAO();
+    
+        try {
+            Pkblobs record = new Pkblobs();
+            record.setId(new Integer(3));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new Pkblobs();
+            record.setId(new Integer(6));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            PkblobsExample example = new PkblobsExample();
+            example.createCriteria().andIdLessThan(new Integer(4));
+            int rows = dao.countByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(2, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testFieldsBlobsCountByExample() {
+        FieldsblobsDAO dao = getFieldsblobsDAO();
+    
+        try {
+            FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new FieldsblobsWithBLOBs();
+            record.setFirstname("Scott");
+            record.setLastname("Jones");
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            FieldsblobsExample example = new FieldsblobsExample();
+            example.createCriteria().andFirstnameLike("S%");
+            int rows = dao.countByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(2, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAwfulTableCountByExample() {
+        AwfulTableDAO dao = getAwfulTableDAO();
+    
+        try {
+            AwfulTable record = new AwfulTable();
+            record.seteMail("fred@fred.com");
+            record.setEmailaddress("alsofred@fred.com");
+            record.setFirstFirstName("fred1");
+            record.setFourthFirstName("fred4");
+            record.setFrom("from field");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setId5(new Integer(5));
+            record.setId6(new Integer(6));
+            record.setId7(new Integer(7));
+            record.setSecondCustomerId(new Integer(567));
+            record.setSecondFirstName("fred2");
+            record.setThirdFirstName("fred3");
+    
+            dao.insert(record);
+    
+            record = new AwfulTable();
+            record.seteMail("fred2@fred.com");
+            record.setEmailaddress("alsofred2@fred.com");
+            record.setFirstFirstName("fred11");
+            record.setFourthFirstName("fred44");
+            record.setFrom("from from field");
+            record.setId1(new Integer(11));
+            record.setId2(new Integer(22));
+            record.setId5(new Integer(55));
+            record.setId6(new Integer(66));
+            record.setId7(new Integer(77));
+            record.setSecondCustomerId(new Integer(567567));
+            record.setSecondFirstName("fred22");
+            record.setThirdFirstName("fred33");
+    
+            dao.insert(record);
+    
+            AwfulTableExample example = new AwfulTableExample();
+            example.createCriteria().andEMailLike("fred@%");
+            int rows = dao.countByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            rows = dao.countByExample(example);
+            assertEquals(2, rows);
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByExampleTest.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,292 @@
+package ibatortest.java2.execute.conditional.java2;
+
+import ibatortest.java2.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsonlyDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkonlyDAO;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTable;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTableExample;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsWithBLOBs;
+import ibatortest.java2.generated.conditional.java2.model.Fieldsonly;
+import ibatortest.java2.generated.conditional.java2.model.FieldsonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfields;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+
+import java.util.List;
+
+public class DeleteByExampleTest extends AbstractConditionalJava2Test {
+
+    public void testFieldsOnlyDeleteByExample() {
+        FieldsonlyDAO dao = getFieldsonlyDAO();
+    
+        try {
+            Fieldsonly record = new Fieldsonly();
+            record.setDoublefield(new Double(11.22));
+            record.setFloatfield(new Double(33.44));
+            record.setIntegerfield(new Integer(5));
+            dao.insert(record);
+    
+            record = new Fieldsonly();
+            record.setDoublefield(new Double(44.55));
+            record.setFloatfield(new Double(66.77));
+            record.setIntegerfield(new Integer(8));
+            dao.insert(record);
+    
+            record = new Fieldsonly();
+            record.setDoublefield(new Double(88.99));
+            record.setFloatfield(new Double(100.111));
+            record.setIntegerfield(new Integer(9));
+            dao.insert(record);
+    
+            FieldsonlyExample example = new FieldsonlyExample();
+            example.createCriteria().andIntegerfieldGreaterThan(new Integer(5));
+    
+            int rows = dao.deleteByExample(example);
+            assertEquals(2, rows);
+    
+            example = new FieldsonlyExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKOnlyDeleteByExample() {
+        PkonlyDAO dao = getPkonlyDAO();
+    
+        try {
+            PkonlyKey key = new PkonlyKey();
+            key.setId(new Integer(1));
+            key.setSeqNum(new Integer(3));
+            dao.insert(key);
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(5));
+            key.setSeqNum(new Integer(6));
+            dao.insert(key);
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(7));
+            key.setSeqNum(new Integer(8));
+            dao.insert(key);
+    
+            PkonlyExample example = new PkonlyExample();
+            example.createCriteria().andIdGreaterThan(new Integer(4));
+            int rows = dao.deleteByExample(example);
+            assertEquals(2, rows);
+    
+            example = new PkonlyExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsDeleteByExample() {
+        PkfieldsDAO dao = getPkfieldsDAO();
+    
+        try {
+            Pkfields record = new Pkfields();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            dao.insert(record);
+    
+            record = new Pkfields();
+            record.setFirstname("Bob");
+            record.setLastname("Jones");
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+    
+            dao.insert(record);
+    
+            PkfieldsExample example = new PkfieldsExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(2, answer.size());
+    
+            example = new PkfieldsExample();
+            example.createCriteria().andLastnameLike("J%");
+            int rows = dao.deleteByExample(example);
+            assertEquals(1, rows);
+    
+            example = new PkfieldsExample();
+            answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKBlobsDeleteByExample() {
+        PkblobsDAO dao = getPkblobsDAO();
+    
+        try {
+            Pkblobs record = new Pkblobs();
+            record.setId(new Integer(3));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new Pkblobs();
+            record.setId(new Integer(6));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            PkblobsExample example = new PkblobsExample();
+            List answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(2, answer.size());
+    
+            example = new PkblobsExample();
+            example.createCriteria().andIdLessThan(new Integer(4));
+            int rows = dao.deleteByExample(example);
+            assertEquals(1, rows);
+    
+            example = new PkblobsExample();
+            answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsBlobsDeleteByExample() {
+        PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
+    
+        try {
+            Pkfieldsblobs record = new Pkfieldsblobs();
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new Pkfieldsblobs();
+            record.setId1(new Integer(5));
+            record.setId2(new Integer(6));
+            record.setFirstname("Scott");
+            record.setLastname("Jones");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            PkfieldsblobsExample example = new PkfieldsblobsExample();
+            List answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(2, answer.size());
+    
+            example = new PkfieldsblobsExample();
+            example.createCriteria().andId1NotEqualTo(new Integer(3));
+            int rows = dao.deleteByExample(example);
+            assertEquals(1, rows);
+    
+            example = new PkfieldsblobsExample();
+            answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testFieldsBlobsDeleteByExample() {
+        FieldsblobsDAO dao = getFieldsblobsDAO();
+    
+        try {
+            FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new FieldsblobsWithBLOBs();
+            record.setFirstname("Scott");
+            record.setLastname("Jones");
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            FieldsblobsExample example = new FieldsblobsExample();
+            List answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(2, answer.size());
+    
+            example = new FieldsblobsExample();
+            example.createCriteria().andFirstnameLike("S%");
+            int rows = dao.deleteByExample(example);
+            assertEquals(1, rows);
+    
+            example = new FieldsblobsExample();
+            answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAwfulTableDeleteByExample() {
+        AwfulTableDAO dao = getAwfulTableDAO();
+    
+        try {
+            AwfulTable record = new AwfulTable();
+            record.seteMail("fred@fred.com");
+            record.setEmailaddress("alsofred@fred.com");
+            record.setFirstFirstName("fred1");
+            record.setFourthFirstName("fred4");
+            record.setFrom("from field");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setId5(new Integer(5));
+            record.setId6(new Integer(6));
+            record.setId7(new Integer(7));
+            record.setSecondCustomerId(new Integer(567));
+            record.setSecondFirstName("fred2");
+            record.setThirdFirstName("fred3");
+    
+            dao.insert(record);
+    
+            record = new AwfulTable();
+            record.seteMail("fred2@fred.com");
+            record.setEmailaddress("alsofred2@fred.com");
+            record.setFirstFirstName("fred11");
+            record.setFourthFirstName("fred44");
+            record.setFrom("from from field");
+            record.setId1(new Integer(11));
+            record.setId2(new Integer(22));
+            record.setId5(new Integer(55));
+            record.setId6(new Integer(66));
+            record.setId7(new Integer(77));
+            record.setSecondCustomerId(new Integer(567567));
+            record.setSecondFirstName("fred22");
+            record.setThirdFirstName("fred33");
+    
+            dao.insert(record);
+    
+            AwfulTableExample example = new AwfulTableExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(2, answer.size());
+    
+            example = new AwfulTableExample();
+            example.createCriteria().andEMailLike("fred@%");
+            int rows = dao.deleteByExample(example);
+            assertEquals(1, rows);
+    
+            example.clear();
+            answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/DeleteByPrimaryKeyTest.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,177 @@
+package ibatortest.java2.execute.conditional.java2;
+
+import ibatortest.java2.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkonlyDAO;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTable;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTableExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfields;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsExample;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsKey;
+import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsKey;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+
+import java.util.List;
+
+public class DeleteByPrimaryKeyTest extends AbstractConditionalJava2Test {
+
+    public void testPKOnlyDeleteByPrimaryKey() {
+        PkonlyDAO dao = getPkonlyDAO();
+    
+        try {
+            PkonlyKey key = new PkonlyKey();
+            key.setId(new Integer(1));
+            key.setSeqNum(new Integer(3));
+            dao.insert(key);
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(5));
+            key.setSeqNum(new Integer(6));
+            dao.insert(key);
+    
+            PkonlyExample example = new PkonlyExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(2, answer.size());
+    
+            key = new PkonlyKey();
+            key.setId(new Integer(5));
+            key.setSeqNum(new Integer(6));
+            int rows = dao.deleteByPrimaryKey(key);
+            assertEquals(1, rows);
+    
+            answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKfieldsDeleteByPrimaryKey() {
+        PkfieldsDAO dao = getPkfieldsDAO();
+    
+        try {
+            Pkfields record = new Pkfields();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+    
+            dao.insert(record);
+    
+            PkfieldsKey key = new PkfieldsKey();
+            key.setId1(new Integer(1));
+            key.setId2(new Integer(2));
+    
+            int rows = dao.deleteByPrimaryKey(key);
+            assertEquals(1, rows);
+    
+            PkfieldsExample example = new PkfieldsExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(0, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKBlobsDeleteByPrimaryKey() {
+        PkblobsDAO dao = getPkblobsDAO();
+    
+        try {
+            Pkblobs record = new Pkblobs();
+            record.setId(new Integer(3));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            PkblobsExample example = new PkblobsExample();
+            List answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(1, answer.size());
+    
+            int rows = dao.deleteByPrimaryKey(new Integer(3));
+            assertEquals(1, rows);
+    
+            example = new PkblobsExample();
+            answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(0, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsBlobsDeleteByPrimaryKey() {
+        PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
+    
+        try {
+            Pkfieldsblobs record = new Pkfieldsblobs();
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            record = new Pkfieldsblobs();
+            record.setId1(new Integer(5));
+            record.setId2(new Integer(6));
+            record.setFirstname("Scott");
+            record.setLastname("Jones");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            PkfieldsblobsExample example = new PkfieldsblobsExample();
+            List answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(2, answer.size());
+    
+            PkfieldsblobsKey key = new PkfieldsblobsKey();
+            key.setId1(new Integer(5));
+            key.setId2(new Integer(6));
+            int rows = dao.deleteByPrimaryKey(key);
+            assertEquals(1, rows);
+    
+            example = new PkfieldsblobsExample();
+            answer = dao.selectByExampleWithoutBLOBs(example);
+            assertEquals(1, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAwfulTableDeleteByPrimaryKey() {
+        AwfulTableDAO dao = getAwfulTableDAO();
+    
+        try {
+            AwfulTable record = new AwfulTable();
+            record.seteMail("fred@fred.com");
+            record.setEmailaddress("alsofred@fred.com");
+            record.setFirstFirstName("fred1");
+            record.setFourthFirstName("fred4");
+            record.setFrom("from field");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setId5(new Integer(5));
+            record.setId6(new Integer(6));
+            record.setId7(new Integer(7));
+            record.setSecondCustomerId(new Integer(567));
+            record.setSecondFirstName("fred2");
+            record.setThirdFirstName("fred3");
+    
+            Integer generatedCustomerId = dao.insert(record);
+    
+            int rows = dao.deleteByPrimaryKey(generatedCustomerId);
+            assertEquals(1, rows);
+    
+            AwfulTableExample example = new AwfulTableExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(0, answer.size());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+}

Added: ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java?rev=833772&view=auto
==============================================================================
--- ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java (added)
+++ ibatis/java/ibator/trunk/core/ibator-systests-ibatis2-java2/src/test/java/ibatortest/java2/execute/conditional/java2/InsertTest.java Sat Nov  7 22:59:00 2009
@@ -0,0 +1,310 @@
+package ibatortest.java2.execute.conditional.java2;
+
+import ibatortest.java2.generated.conditional.java2.dao.AwfulTableDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.FieldsonlyDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkfieldsblobsDAO;
+import ibatortest.java2.generated.conditional.java2.dao.PkonlyDAO;
+import ibatortest.java2.generated.conditional.java2.model.AwfulTable;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.FieldsblobsWithBLOBs;
+import ibatortest.java2.generated.conditional.java2.model.Fieldsonly;
+import ibatortest.java2.generated.conditional.java2.model.FieldsonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.Pkfields;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsKey;
+import ibatortest.java2.generated.conditional.java2.model.Pkfieldsblobs;
+import ibatortest.java2.generated.conditional.java2.model.PkfieldsblobsExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyExample;
+import ibatortest.java2.generated.conditional.java2.model.PkonlyKey;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+public class InsertTest extends AbstractConditionalJava2Test {
+
+    public void testFieldsOnlyInsert() {
+        FieldsonlyDAO dao = getFieldsonlyDAO();
+    
+        try {
+            Fieldsonly record = new Fieldsonly();
+            record.setDoublefield(new Double(11.22));
+            record.setFloatfield(new Double(33.44));
+            record.setIntegerfield(new Integer(5));
+            dao.insert(record);
+    
+            FieldsonlyExample example = new FieldsonlyExample();
+            example.createCriteria().andIntegerfieldEqualTo(new Integer(5));
+    
+            List answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+    
+            Fieldsonly returnedRecord = (Fieldsonly) answer.get(0);
+            assertEquals(record.getIntegerfield(), returnedRecord
+                    .getIntegerfield());
+            assertEquals(record.getDoublefield(), returnedRecord
+                    .getDoublefield());
+            assertEquals(record.getFloatfield(), returnedRecord.getFloatfield());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKOnlyInsert() {
+        PkonlyDAO dao = getPkonlyDAO();
+    
+        try {
+            PkonlyKey key = new PkonlyKey();
+            key.setId(new Integer(1));
+            key.setSeqNum(new Integer(3));
+            dao.insert(key);
+    
+            PkonlyExample example = new PkonlyExample();
+            List answer = dao.selectByExample(example);
+            assertEquals(1, answer.size());
+    
+            PkonlyKey returnedRecord = (PkonlyKey) answer.get(0);
+            assertEquals(key.getId(), returnedRecord.getId());
+            assertEquals(key.getSeqNum(), returnedRecord.getSeqNum());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsInsert() {
+        PkfieldsDAO dao = getPkfieldsDAO();
+    
+        try {
+            Pkfields record = new Pkfields();
+            record.setDatefield(new Date());
+            record.setDecimal100field(new Long(10L));
+            record.setDecimal155field(new BigDecimal("15.12345"));
+            record.setDecimal30field(new Short((short) 3));
+            record.setDecimal60field(new Integer(6));
+            record.setFirstname("Jeff");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setLastname("Butler");
+            record.setTimefield(new Date());
+            record.setTimestampfield(new Date());
+    
+            dao.insert(record);
+    
+            PkfieldsKey key = new PkfieldsKey();
+            key.setId1(new Integer(1));
+            key.setId2(new Integer(2));
+    
+            Pkfields returnedRecord = dao.selectByPrimaryKey(key);
+            assertNotNull(returnedRecord);
+    
+            assertTrue(datesAreEqual(record.getDatefield(), returnedRecord
+                    .getDatefield()));
+            assertEquals(record.getDecimal100field(), returnedRecord
+                    .getDecimal100field());
+            assertEquals(record.getDecimal155field(), returnedRecord
+                    .getDecimal155field());
+            assertEquals(record.getDecimal30field(), returnedRecord
+                    .getDecimal30field());
+            assertEquals(record.getDecimal60field(), returnedRecord
+                    .getDecimal60field());
+            assertEquals(record.getFirstname(), returnedRecord.getFirstname());
+            assertEquals(record.getId1(), returnedRecord.getId1());
+            assertEquals(record.getId2(), returnedRecord.getId2());
+            assertEquals(record.getLastname(), returnedRecord.getLastname());
+            assertTrue(timesAreEqual(record.getTimefield(), returnedRecord
+                    .getTimefield()));
+            assertEquals(record.getTimestampfield(), returnedRecord
+                    .getTimestampfield());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKBlobsInsert() {
+        PkblobsDAO dao = getPkblobsDAO();
+    
+        try {
+            Pkblobs record = new Pkblobs();
+            record.setId(new Integer(3));
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            PkblobsExample example = new PkblobsExample();
+            List answer = dao.selectByExampleWithBLOBs(example);
+            assertEquals(1, answer.size());
+    
+            Pkblobs returnedRecord = (Pkblobs) answer.get(0);
+            assertEquals(record.getId(), returnedRecord.getId());
+            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+                    .getBlob1()));
+            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord
+                    .getBlob2()));
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testPKFieldsBlobsInsert() {
+        PkfieldsblobsDAO dao = getPkfieldsblobsDAO();
+    
+        try {
+            Pkfieldsblobs record = new Pkfieldsblobs();
+            record.setId1(new Integer(3));
+            record.setId2(new Integer(4));
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            dao.insert(record);
+    
+            PkfieldsblobsExample example = new PkfieldsblobsExample();
+            List answer = dao.selectByExampleWithBLOBs(example);
+            assertEquals(1, answer.size());
+    
+            Pkfieldsblobs returnedRecord = (Pkfieldsblobs) answer.get(0);
+            assertEquals(record.getId1(), returnedRecord.getId1());
+            assertEquals(record.getId2(), returnedRecord.getId2());
+            assertEquals(record.getFirstname(), returnedRecord.getFirstname());
+            assertEquals(record.getLastname(), returnedRecord.getLastname());
+            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+                    .getBlob1()));
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testFieldsBlobsInsert() {
+        FieldsblobsDAO dao = getFieldsblobsDAO();
+    
+        try {
+            FieldsblobsWithBLOBs record = new FieldsblobsWithBLOBs();
+            record.setFirstname("Jeff");
+            record.setLastname("Smith");
+            record.setBlob1(generateRandomBlob());
+            record.setBlob2(generateRandomBlob());
+            dao.insert(record);
+    
+            FieldsblobsExample example = new FieldsblobsExample();
+            List answer = dao.selectByExampleWithBLOBs(example);
+            assertEquals(1, answer.size());
+    
+            FieldsblobsWithBLOBs returnedRecord = (FieldsblobsWithBLOBs) answer
+                    .get(0);
+            assertEquals(record.getFirstname(), returnedRecord.getFirstname());
+            assertEquals(record.getLastname(), returnedRecord.getLastname());
+            assertTrue(blobsAreEqual(record.getBlob1(), returnedRecord
+                    .getBlob1()));
+            assertTrue(blobsAreEqual(record.getBlob2(), returnedRecord
+                    .getBlob2()));
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAwfulTableInsert() {
+        AwfulTableDAO dao = getAwfulTableDAO();
+    
+        try {
+            AwfulTable record = new AwfulTable();
+    
+            record.seteMail("fred@fred.com");
+            record.setEmailaddress("alsofred@fred.com");
+            record.setFirstFirstName("fred1");
+            record.setFourthFirstName("fred4");
+            record.setFrom("from field");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setId5(new Integer(5));
+            record.setId6(new Integer(6));
+            record.setId7(new Integer(7));
+            record.setSecondCustomerId(new Integer(567));
+            record.setSecondFirstName("fred2");
+            record.setThirdFirstName("fred3");
+            record.setActive(true);
+    
+            Integer generatedCustomerId = dao.insert(record);
+            assertEquals(57, generatedCustomerId.intValue());
+    
+            AwfulTable returnedRecord = dao
+                    .selectByPrimaryKey(generatedCustomerId);
+    
+            assertEquals(generatedCustomerId, returnedRecord.getCustomerId());
+            assertEquals(record.geteMail(), returnedRecord.geteMail());
+            assertEquals(record.getEmailaddress(), returnedRecord
+                    .getEmailaddress());
+            assertEquals(record.getFirstFirstName(), returnedRecord
+                    .getFirstFirstName());
+            assertEquals(record.getFourthFirstName(), returnedRecord
+                    .getFourthFirstName());
+            assertEquals(record.getFrom(), returnedRecord.getFrom());
+            assertEquals(record.getId1(), returnedRecord.getId1());
+            assertEquals(record.getId2(), returnedRecord.getId2());
+            assertEquals(record.getId5(), returnedRecord.getId5());
+            assertEquals(record.getId6(), returnedRecord.getId6());
+            assertEquals(record.getId7(), returnedRecord.getId7());
+            assertEquals(record.getSecondCustomerId(), returnedRecord
+                    .getSecondCustomerId());
+            assertEquals(record.getSecondFirstName(), returnedRecord
+                    .getSecondFirstName());
+            assertEquals(record.getThirdFirstName(), returnedRecord
+                    .getThirdFirstName());
+            assertEquals(record.isActive(), returnedRecord
+                    .isActive());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+
+    public void testAwfulTableInsertSelective() {
+        AwfulTableDAO dao = getAwfulTableDAO();
+
+        try {
+            AwfulTable record = new AwfulTable();
+
+            record.seteMail("fred@fred.com");
+            record.setEmailaddress("alsofred@fred.com");
+            record.setFourthFirstName("fred4");
+            record.setFrom("from field");
+            record.setId1(new Integer(1));
+            record.setId2(new Integer(2));
+            record.setId5(new Integer(5));
+            record.setId6(new Integer(6));
+            record.setId7(new Integer(7));
+            record.setSecondCustomerId(new Integer(567));
+            record.setSecondFirstName("fred2");
+            record.setThirdFirstName("fred3");
+
+            Integer generatedCustomerId = dao.insertSelective(record);
+            assertEquals(57, generatedCustomerId.intValue());
+
+            AwfulTable returnedRecord = dao
+                    .selectByPrimaryKey(generatedCustomerId);
+
+            assertEquals(generatedCustomerId, returnedRecord.getCustomerId());
+            assertEquals(record.geteMail(), returnedRecord.geteMail());
+            assertEquals(record.getEmailaddress(), returnedRecord
+                    .getEmailaddress());
+            assertEquals("Mabel", returnedRecord.getFirstFirstName());
+            assertEquals(record.getFourthFirstName(), returnedRecord
+                    .getFourthFirstName());
+            assertEquals(record.getFrom(), returnedRecord.getFrom());
+            assertEquals(record.getId1(), returnedRecord.getId1());
+            assertEquals(record.getId2(), returnedRecord.getId2());
+            assertEquals(record.getId5(), returnedRecord.getId5());
+            assertEquals(record.getId6(), returnedRecord.getId6());
+            assertEquals(record.getId7(), returnedRecord.getId7());
+            assertEquals(record.getSecondCustomerId(), returnedRecord
+                    .getSecondCustomerId());
+            assertEquals(record.getSecondFirstName(), returnedRecord
+                    .getSecondFirstName());
+            assertEquals(record.getThirdFirstName(), returnedRecord
+                    .getThirdFirstName());
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+    }
+}



Mime
View raw message