cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From evg...@apache.org
Subject svn commit: r899143 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/jdbc/ main/java/org/apache/cayenne/dba/ test/java/org/apache/art/ test/java/org/apache/art/auto/ test/java/org/apache/cayenne/acc...
Date Thu, 14 Jan 2010 10:14:56 GMT
Author: evgeny
Date: Thu Jan 14 10:14:55 2010
New Revision: 899143

URL: http://svn.apache.org/viewvc?rev=899143&view=rev
Log:
CAY-1354
Wrong Types mapping for selected values in Row Queries

Fixed default mapping for most of types. Add JUnits to control regression. Still problem with mapping of float.

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap1.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap2.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap1.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap2.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ColumnDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ColumnDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ColumnDescriptor.java?rev=899143&r1=899142&r2=899143&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ColumnDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ColumnDescriptor.java Thu Jan 14 10:14:55 2010
@@ -62,7 +62,9 @@
      * Creates a column descriptor with user-specified parameters.
      * 
      * @since 1.2
+     * @deprecated use ColumnDescriptor(String columnName, int jdbcType) instead
      */
+    @Deprecated
     public ColumnDescriptor(String columnName, int jdbcType, String javaClass) {
         this.name = columnName;
         this.dataRowKey = columnName;
@@ -71,17 +73,25 @@
     }
 
     /**
+     * Creates a column descriptor with user-specified parameters.
+     * 
+     * @since 3.1
+     */
+    public ColumnDescriptor(String columnName, int jdbcType) {
+        this.name = columnName;
+        this.dataRowKey = columnName;
+        this.jdbcType = jdbcType;
+        this.javaClass = TypesMapping.getJavaBySqlType(jdbcType);
+    }
+
+    /**
      * Creates a ColumnDescriptor from Cayenne DbAttribute.
      * 
      * @since 1.2
      */
     public ColumnDescriptor(DbAttribute attribute, String tableAlias) {
-        this.name = attribute.getName();
+        this(attribute.getName(), attribute.getType());
         this.namePrefix = tableAlias;
-        this.dataRowKey = name;
-        this.jdbcType = attribute.getType();
-        this.javaClass = getDefaultJavaClass(attribute.getMaxLength(), attribute
-                .getScale());
 
         if (attribute.getEntity() != null) {
             this.tableName = attribute.getEntity().getName();
@@ -104,11 +114,7 @@
      * @since 1.2
      */
     public ColumnDescriptor(ProcedureParameter parameter) {
-        this.name = parameter.getName();
-        this.dataRowKey = name;
-        this.jdbcType = parameter.getType();
-        this.javaClass = getDefaultJavaClass(parameter.getMaxLength(), parameter
-                .getPrecision());
+        this(parameter.getName(), parameter.getType());
 
         if (parameter.getProcedure() != null) {
             this.procedureName = parameter.getProcedure().getName();
@@ -118,9 +124,24 @@
     /**
      * Creates a ColumnDescriptor using ResultSetMetaData.
      * 
+     * @since 3.1
+     */
+    public ColumnDescriptor(String columnName, ResultSetMetaData metaData, int position)
+            throws SQLException {
+        this(columnName, metaData.getColumnType(position));
+    }
+
+    /**
+     * Creates a ColumnDescriptor using ResultSetMetaData.
+     * 
      * @since 1.2
      */
     public ColumnDescriptor(ResultSetMetaData metaData, int position) throws SQLException {
+        this(getColumnNameFromMeta(metaData, position), metaData, position);
+    }
+
+    private static String getColumnNameFromMeta(ResultSetMetaData metaData, int position)
+            throws SQLException {
         String name = metaData.getColumnLabel(position);
         if (name == null || name.length() == 0) {
             name = metaData.getColumnName(position);
@@ -129,11 +150,7 @@
                 name = "column_" + position;
             }
         }
-
-        this.name = name;
-        this.dataRowKey = name;
-        this.jdbcType = metaData.getColumnType(position);
-        this.javaClass = metaData.getColumnClassName(position);
+        return name;
     }
 
     /**
@@ -185,7 +202,9 @@
      * Returns a default Java class for an internal JDBC type.
      * 
      * @since 1.2
+     * @deprecated use TypesMapping.getJavaBySqlType(int type) instead
      */
+    @Deprecated
     public String getDefaultJavaClass(int size, int scale) {
         return TypesMapping.getJavaBySqlType(getJdbcType(), size, scale);
     }
@@ -198,7 +217,7 @@
     public String getQualifiedColumnName() {
         return (namePrefix != null) ? namePrefix + '.' + name : name;
     }
-    
+
     public String getQualifiedColumnNameWithQuoteSqlIdentifiers(QuotingStrategy strategy) {
         String nameWithQuoteSqlIdentifiers = strategy.quoteString( name );
         return (namePrefix != null) ? strategy.quoteString( namePrefix ) + '.' +

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java?rev=899143&r1=899142&r2=899143&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java Thu Jan 14 10:14:55 2010
@@ -158,10 +158,7 @@
             }
         }
         // columnArray doesn't contain ColumnDescriptor for specified column
-        return new ColumnDescriptor(
-                rowKey,
-                resultSetMetadata.getColumnType(position),
-                resultSetMetadata.getColumnClassName(position));
+        return new ColumnDescriptor(rowKey, resultSetMetadata, position);
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java?rev=899143&r1=899142&r2=899143&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/TypesMapping.java Thu Jan 14 10:14:55 2010
@@ -449,7 +449,10 @@
      * etc.
      * 
      * @return Fully qualified Java type name or null if not found.
+     * @deprecated use getJavaBySqlType(int type) instead. No usable since "0" can means
+     *             "undefined", not really zero.
      */
+    @Deprecated
     public static String getJavaBySqlType(int type, int length, int scale) {
 
         // this does not always produce the correct result. See for instance CAY-1052 - PG

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap1.java?rev=899143&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap1.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap1.java Thu Jan 14 10:14:55 2010
@@ -0,0 +1,7 @@
+package org.apache.art;
+
+import org.apache.art.auto._ReturnTypesMap1;
+
+public class ReturnTypesMap1 extends _ReturnTypesMap1 {
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap2.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap2.java?rev=899143&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap2.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ReturnTypesMap2.java Thu Jan 14 10:14:55 2010
@@ -0,0 +1,7 @@
+package org.apache.art;
+
+import org.apache.art.auto._ReturnTypesMap2;
+
+public class ReturnTypesMap2 extends _ReturnTypesMap2 {
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap1.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap1.java?rev=899143&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap1.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap1.java Thu Jan 14 10:14:55 2010
@@ -0,0 +1,163 @@
+package org.apache.art.auto;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _ReturnTypesMap was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _ReturnTypesMap1 extends CayenneDataObject {
+
+    public static final String BIGINT_COLUMN_PROPERTY = "bigintColumn";
+    public static final String BIT_COLUMN_PROPERTY = "bitColumn";
+    public static final String BOOLEAN_COLUMN_PROPERTY = "booleanColumn";
+    public static final String CHAR_COLUMN_PROPERTY = "charColumn";
+    public static final String CLOB_COLUMN_PROPERTY = "clobColumn";
+    public static final String DATE_COLUMN_PROPERTY = "dateColumn";
+    public static final String DECIMAL_COLUMN_PROPERTY = "decimalColumn";
+    public static final String DOUBLE_COLUMN_PROPERTY = "doubleColumn";
+    public static final String FLOAT_COLUMN_PROPERTY = "floatColumn";
+    public static final String INTEGER_COLUMN_PROPERTY = "integerColumn";
+    public static final String LONGVARCHAR_COLUMN_PROPERTY = "longvarcharColumn";
+    public static final String NUMERIC_COLUMN_PROPERTY = "numericColumn";
+    public static final String REAL_COLUMN_PROPERTY = "realColumn";
+    public static final String SMALLINT_COLUMN_PROPERTY = "smallintColumn";
+    public static final String TIME_COLUMN_PROPERTY = "timeColumn";
+    public static final String TIMESTAMP_COLUMN_PROPERTY = "timestampColumn";
+    public static final String TINYINT_COLUMN_PROPERTY = "tinyintColumn";
+    public static final String VARCHAR_COLUMN_PROPERTY = "varcharColumn";
+
+    public static final String AAAID_PK_COLUMN = "AAAID";
+
+    public void setBigintColumn(Long bigintColumn) {
+        writeProperty("bigintColumn", bigintColumn);
+    }
+    public Long getBigintColumn() {
+        return (Long)readProperty("bigintColumn");
+    }
+
+    public void setBitColumn(Boolean bitColumn) {
+        writeProperty("bitColumn", bitColumn);
+    }
+    public Boolean getBitColumn() {
+        return (Boolean)readProperty("bitColumn");
+    }
+
+    public void setBooleanColumn(Boolean booleanColumn) {
+        writeProperty("booleanColumn", booleanColumn);
+    }
+    public Boolean getBooleanColumn() {
+        return (Boolean)readProperty("booleanColumn");
+    }
+
+    public void setCharColumn(String charColumn) {
+        writeProperty("charColumn", charColumn);
+    }
+    public String getCharColumn() {
+        return (String)readProperty("charColumn");
+    }
+
+    public void setClobColumn(String clobColumn) {
+        writeProperty("clobColumn", clobColumn);
+    }
+    public String getClobColumn() {
+        return (String)readProperty("clobColumn");
+    }
+
+    public void setDateColumn(Date dateColumn) {
+        writeProperty("dateColumn", dateColumn);
+    }
+    public Date getDateColumn() {
+        return (Date)readProperty("dateColumn");
+    }
+
+    public void setDecimalColumn(BigDecimal decimalColumn) {
+        writeProperty("decimalColumn", decimalColumn);
+    }
+    public BigDecimal getDecimalColumn() {
+        return (BigDecimal)readProperty("decimalColumn");
+    }
+
+    public void setDoubleColumn(Double doubleColumn) {
+        writeProperty("doubleColumn", doubleColumn);
+    }
+    public Double getDoubleColumn() {
+        return (Double)readProperty("doubleColumn");
+    }
+
+    public void setFloatColumn(Float floatColumn) {
+        writeProperty("floatColumn", floatColumn);
+    }
+    public Float getFloatColumn() {
+        return (Float)readProperty("floatColumn");
+    }
+
+    public void setIntegerColumn(Integer integerColumn) {
+        writeProperty("integerColumn", integerColumn);
+    }
+    public Integer getIntegerColumn() {
+        return (Integer)readProperty("integerColumn");
+    }
+
+    public void setLongvarcharColumn(String longvarcharColumn) {
+        writeProperty("longvarcharColumn", longvarcharColumn);
+    }
+    public String getLongvarcharColumn() {
+        return (String)readProperty("longvarcharColumn");
+    }
+
+    public void setNumericColumn(BigDecimal numericColumn) {
+        writeProperty("numericColumn", numericColumn);
+    }
+    public BigDecimal getNumericColumn() {
+        return (BigDecimal)readProperty("numericColumn");
+    }
+
+    public void setRealColumn(Float realColumn) {
+        writeProperty("realColumn", realColumn);
+    }
+    public Float getRealColumn() {
+        return (Float)readProperty("realColumn");
+    }
+
+    public void setSmallintColumn(Short smallintColumn) {
+        writeProperty("smallintColumn", smallintColumn);
+    }
+    public Short getSmallintColumn() {
+        return (Short)readProperty("smallintColumn");
+    }
+
+    public void setTimeColumn(Date timeColumn) {
+        writeProperty("timeColumn", timeColumn);
+    }
+    public Date getTimeColumn() {
+        return (Date)readProperty("timeColumn");
+    }
+
+    public void setTimestampColumn(Date timestampColumn) {
+        writeProperty("timestampColumn", timestampColumn);
+    }
+    public Date getTimestampColumn() {
+        return (Date)readProperty("timestampColumn");
+    }
+
+    public void setTinyintColumn(Byte tinyintColumn) {
+        writeProperty("tinyintColumn", tinyintColumn);
+    }
+    public Byte getTinyintColumn() {
+        return (Byte)readProperty("tinyintColumn");
+    }
+
+    public void setVarcharColumn(String varcharColumn) {
+        writeProperty("varcharColumn", varcharColumn);
+    }
+    public String getVarcharColumn() {
+        return (String)readProperty("varcharColumn");
+    }
+
+}

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap2.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap2.java?rev=899143&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap2.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ReturnTypesMap2.java Thu Jan 14 10:14:55 2010
@@ -0,0 +1,48 @@
+package org.apache.art.auto;
+
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _ReturnTypesMap was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _ReturnTypesMap2 extends CayenneDataObject {
+
+    public static final String BINARY_COLUMN_PROPERTY = "binaryColumn";
+    public static final String BLOB_COLUMN_PROPERTY = "blobColumn";
+    public static final String LONGVARBINARY_COLUMN_PROPERTY = "longvarbinaryColumn";
+    public static final String VARBINARY_COLUMN_PROPERTY = "varbinaryColumn";
+
+    public static final String AAAID_PK_COLUMN = "AAAID";
+
+    public void setBinaryColumn(byte[] binaryColumn) {
+        writeProperty("binaryColumn", binaryColumn);
+    }
+    public byte[] getBinaryColumn() {
+        return (byte[])readProperty("binaryColumn");
+    }
+
+    public void setBlobColumn(byte[] blobColumn) {
+        writeProperty("blobColumn", blobColumn);
+    }
+    public byte[] getBlobColumn() {
+        return (byte[])readProperty("blobColumn");
+    }
+
+    public void setLongvarbinaryColumn(byte[] longvarbinaryColumn) {
+        writeProperty("longvarbinaryColumn", longvarbinaryColumn);
+    }
+    public byte[] getLongvarbinaryColumn() {
+        return (byte[])readProperty("longvarbinaryColumn");
+    }
+
+    public void setVarbinaryColumn(byte[] varbinaryColumn) {
+        writeProperty("varbinaryColumn", varbinaryColumn);
+    }
+    public byte[] getVarbinaryColumn() {
+        return (byte[])readProperty("varbinaryColumn");
+    }
+
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java?rev=899143&r1=899142&r2=899143&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DataContextProcedureQueryTest.java Thu Jan 14 10:14:55 2010
@@ -357,12 +357,9 @@
         ColumnDescriptor[] columns = new ColumnDescriptor[3];
 
         // read ID as Long, and everything else as default types
-        columns[0] = new ColumnDescriptor("ARTIST_ID", Types.INTEGER, Long.class
-                .getName());
-        columns[1] = new ColumnDescriptor("ARTIST_NAME", Types.CHAR, String.class
-                .getName());
-        columns[2] = new ColumnDescriptor("DATE_OF_BIRTH", Types.DATE, Date.class
-                .getName());
+        columns[0] = new ColumnDescriptor("ARTIST_ID", Types.BIGINT);
+        columns[1] = new ColumnDescriptor("ARTIST_NAME", Types.CHAR);
+        columns[2] = new ColumnDescriptor("DATE_OF_BIRTH", Types.DATE);
         q.addResultDescriptor(columns);
 
         List rows = runProcedureSelect(q);

Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java?rev=899143&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/ReturnTypesMappingTest.java Thu Jan 14 10:14:55 2010
@@ -0,0 +1,796 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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 org.apache.cayenne.access;
+
+import java.math.BigDecimal;
+import java.sql.Time;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.art.DateTestEntity;
+import org.apache.art.ReturnTypesMap1;
+import org.apache.art.ReturnTypesMap2;
+import org.apache.cayenne.DataRow;
+import org.apache.cayenne.query.NamedQuery;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.unit.CayenneCase;
+
+/**
+ * Test Types mapping for selected columns
+ */
+public class ReturnTypesMappingTest extends CayenneCase {
+
+    protected DataContext context;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        deleteTestData();
+        context = createDataContext();
+    }
+
+    public void testBIGINT() throws Exception {
+        String columnName = "BIGINT_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Long bigintValue = 5326457654783454355l;
+        test.setBigintColumn(bigintValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Long.class, columnValue.getClass());
+        assertEquals(bigintValue, columnValue);
+    }
+
+    public void testBIGINT2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Long bigintValue = 5326457654783454355l;
+        test.setBigintColumn(bigintValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Long columnValue = testRead.getBigintColumn();
+        assertNotNull(columnValue);
+        assertEquals(Long.class, columnValue.getClass());
+        assertEquals(bigintValue, columnValue);
+    }
+
+    public void testBINARY() throws Exception {
+        String columnName = "BINARY_COLUMN";
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] binaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setBinaryColumn(binaryValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap2");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(binaryValue, (byte[]) columnValue));
+    }
+
+    public void testBINARY2() throws Exception {
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] binaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setBinaryColumn(binaryValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap2.class);
+        ReturnTypesMap2 testRead = (ReturnTypesMap2) context.performQuery(q).get(0);
+        byte[] columnValue = testRead.getBinaryColumn();
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(binaryValue, columnValue));
+    }
+
+    public void testBIT() throws Exception {
+        String columnName = "BIT_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Boolean bitValue = true;
+        test.setBitColumn(bitValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Boolean.class, columnValue.getClass());
+        assertEquals(bitValue, columnValue);
+    }
+
+    public void testBIT2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Boolean bitValue = true;
+        test.setBitColumn(bitValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Boolean columnValue = testRead.getBitColumn();
+        assertNotNull(columnValue);
+        assertEquals(Boolean.class, columnValue.getClass());
+        assertEquals(bitValue, columnValue);
+    }
+
+    public void testBLOB() throws Exception {
+        String columnName = "BLOB_COLUMN";
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] blobValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setBlobColumn(blobValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap2");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(blobValue, (byte[]) columnValue));
+    }
+
+    public void testBLOB2() throws Exception {
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] blobValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setBlobColumn(blobValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap2.class);
+        ReturnTypesMap2 testRead = (ReturnTypesMap2) context.performQuery(q).get(0);
+        byte[] columnValue = testRead.getBlobColumn();
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(blobValue, columnValue));
+    }
+
+    public void testBOOLEAN() throws Exception {
+        String columnName = "BOOLEAN_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Boolean booleanValue = true;
+        test.setBooleanColumn(booleanValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Boolean.class, columnValue.getClass());
+        assertEquals(booleanValue, columnValue);
+    }
+
+    public void testBOOLEAN2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Boolean booleanValue = true;
+        test.setBooleanColumn(booleanValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Boolean columnValue = testRead.getBooleanColumn();
+        assertNotNull(columnValue);
+        assertEquals(Boolean.class, columnValue.getClass());
+        assertEquals(booleanValue, columnValue);
+    }
+
+    public void testCHAR() throws Exception {
+        String columnName = "CHAR_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        String charValue = "Char string for tests!";
+        test.setCharColumn(charValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(charValue, columnValue);
+    }
+
+    public void testCHAR2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        String charValue = "Char string for tests!";
+        test.setCharColumn(charValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        String columnValue = testRead.getCharColumn();
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(charValue, columnValue);
+    }
+
+    public void testCLOB() throws Exception {
+        String columnName = "CLOB_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        StringBuffer buffer = new StringBuffer();
+        for (int i = 0; i < 10000; i++) {
+            buffer.append("CLOB very large string for tests!!!!\n");
+        }
+        String clobValue = buffer.toString();
+        test.setClobColumn(clobValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(clobValue, columnValue);
+    }
+
+    public void testCLOB2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        StringBuffer buffer = new StringBuffer();
+        for (int i = 0; i < 10000; i++) {
+            buffer.append("CLOB very large string for tests!!!!\n");
+        }
+        String clobValue = buffer.toString();
+        test.setClobColumn(clobValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        String columnValue = testRead.getClobColumn();
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(clobValue, columnValue);
+    }
+
+    public void testDATE() throws Exception {
+        String columnName = "DATE_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(2002, 1, 1);
+        Date dateValue = cal.getTime();
+        test.setDateColumn(dateValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(dateValue.toString(), columnValue.toString());
+    }
+
+    public void testDATE2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(2002, 1, 1);
+        Date dateValue = cal.getTime();
+        test.setDateColumn(dateValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Date columnValue = testRead.getDateColumn();
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(dateValue.toString(), columnValue.toString());
+    }
+
+    public void testDECIMAL() throws Exception {
+        String columnName = "DECIMAL_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        BigDecimal decimalValue = new BigDecimal("578438.57843");
+        test.setDecimalColumn(decimalValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(BigDecimal.class, columnValue.getClass());
+        assertEquals(decimalValue, columnValue);
+    }
+
+    public void testDECIMAL2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        BigDecimal decimalValue = new BigDecimal("578438.57843");
+        test.setDecimalColumn(decimalValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        BigDecimal columnValue = testRead.getDecimalColumn();
+        assertNotNull(columnValue);
+        assertEquals(BigDecimal.class, columnValue.getClass());
+        assertEquals(decimalValue, columnValue);
+    }
+
+    public void testDOUBLE() throws Exception {
+        String columnName = "DOUBLE_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Double doubleValue = 3298.4349783d;
+        test.setDoubleColumn(doubleValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Double.class, columnValue.getClass());
+        assertEquals(doubleValue, columnValue);
+    }
+
+    public void testDOUBLE2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Double doubleValue = 3298.4349783d;
+        test.setDoubleColumn(doubleValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Double columnValue = testRead.getDoubleColumn();
+        assertNotNull(columnValue);
+        assertEquals(Double.class, columnValue.getClass());
+        assertEquals(doubleValue, columnValue);
+    }
+
+    public void testFLOAT() throws Exception {
+        String columnName = "FLOAT_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Float floatValue = 375.437f;
+        test.setFloatColumn(floatValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Float.class, columnValue.getClass());
+        assertEquals(floatValue, columnValue);
+    }
+
+    public void testFLOAT2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Float floatValue = 375.437f;
+        test.setFloatColumn(floatValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Float columnValue = testRead.getFloatColumn();
+        assertNotNull(columnValue);
+        assertEquals(Float.class, columnValue.getClass());
+        assertEquals(floatValue, columnValue);
+    }
+
+    public void testINTEGER() throws Exception {
+        String columnName = "INTEGER_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Integer integerValue = 54235;
+        test.setIntegerColumn(integerValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Integer.class, columnValue.getClass());
+        assertEquals(integerValue, columnValue);
+    }
+
+    public void testINTEGER2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Integer integerValue = 54235;
+        test.setIntegerColumn(integerValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Integer columnValue = testRead.getIntegerColumn();
+        assertNotNull(columnValue);
+        assertEquals(Integer.class, columnValue.getClass());
+        assertEquals(integerValue, columnValue);
+    }
+
+    public void testLONGVARBINARY() throws Exception {
+        String columnName = "LONGVARBINARY_COLUMN";
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] longvarbinaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setLongvarbinaryColumn(longvarbinaryValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap2");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(longvarbinaryValue, (byte[]) columnValue));
+    }
+
+    public void testLONGVARBINARY2() throws Exception {
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] longvarbinaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setLongvarbinaryColumn(longvarbinaryValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap2.class);
+        ReturnTypesMap2 testRead = (ReturnTypesMap2) context.performQuery(q).get(0);
+        byte[] columnValue = testRead.getLongvarbinaryColumn();
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(longvarbinaryValue, columnValue));
+    }
+
+    public void testLONGVARCHAR() throws Exception {
+        String columnName = "LONGVARCHAR_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        StringBuffer buffer = new StringBuffer();
+        for (int i = 0; i < 10000; i++) {
+            buffer.append("LONGVARCHAR very large string for tests!!!!\n");
+        }
+        String longvarcharValue = buffer.toString();
+        test.setLongvarcharColumn(longvarcharValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(longvarcharValue, columnValue);
+    }
+
+    public void testLONGVARCHAR2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        StringBuffer buffer = new StringBuffer();
+        for (int i = 0; i < 10000; i++) {
+            buffer.append("LONGVARCHAR very large string for tests!!!!\n");
+        }
+        String longvarcharValue = buffer.toString();
+        test.setLongvarcharColumn(longvarcharValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        String columnValue = testRead.getLongvarcharColumn();
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(longvarcharValue, columnValue);
+    }
+
+    public void testNUMERIC() throws Exception {
+        String columnName = "NUMERIC_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        BigDecimal numericValue = new BigDecimal("578438.57843");
+        test.setNumericColumn(numericValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(BigDecimal.class, columnValue.getClass());
+        assertEquals(numericValue, columnValue);
+    }
+
+    public void testNUMERIC2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        BigDecimal numericValue = new BigDecimal("578438.57843");
+        test.setNumericColumn(numericValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        BigDecimal columnValue = testRead.getNumericColumn();
+        assertNotNull(columnValue);
+        assertEquals(BigDecimal.class, columnValue.getClass());
+        assertEquals(numericValue, columnValue);
+    }
+
+    public void testREAL() throws Exception {
+        String columnName = "REAL_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Float realValue = 5788.57843f;
+        test.setRealColumn(realValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Float.class, columnValue.getClass());
+        assertEquals(realValue, columnValue);
+    }
+
+    public void testREAL2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Float realValue = 5788.57843f;
+        test.setRealColumn(realValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Float columnValue = testRead.getRealColumn();
+        assertNotNull(columnValue);
+        assertEquals(Float.class, columnValue.getClass());
+        assertEquals(realValue, columnValue);
+    }
+
+    public void testSMALLINT() throws Exception {
+        String columnName = "SMALLINT_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Short smallintValue = 32564;
+        test.setSmallintColumn(smallintValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Short.class, columnValue.getClass());
+        assertEquals(smallintValue, columnValue);
+    }
+
+    public void testSMALLINT2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Short smallintValue = 32564;
+        test.setSmallintColumn(smallintValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Short columnValue = testRead.getSmallintColumn();
+        assertNotNull(columnValue);
+        assertEquals(Short.class, columnValue.getClass());
+        assertEquals(smallintValue, columnValue);
+    }
+
+    public void testTIME() throws Exception {
+        String columnName = "TIME_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(2003, 1, 1, 1, 20, 30);
+        Date timeValue = new Time(cal.getTime().getTime());
+        test.setTimeColumn(timeValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(timeValue.toString(), new Time(((Date)columnValue).getTime()).toString());
+    }
+
+    public void testTIME2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(2003, 1, 1, 1, 20, 30);
+        Date timeValue = new Time(cal.getTime().getTime());
+        test.setTimeColumn(timeValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Date columnValue = testRead.getTimeColumn();
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(timeValue.toString(), new Time(columnValue.getTime()).toString());
+    }
+    
+    public void testSQLTemplateTime() throws Exception {
+        DateTestEntity test = (DateTestEntity) context.newObject("DateTestEntity");
+
+        Calendar cal = Calendar.getInstance();
+        cal.clear();
+        cal.set(2003, 1, 1, 1, 20, 30);
+
+        // most databases fail millisecond accuracy
+        // cal.set(Calendar.MILLISECOND, 55);
+
+        Time now = new Time(cal.getTime().getTime());
+        test.setTimeColumn(now);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectDateTest");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Date columnValue = (Date) testRead.get("TIME_COLUMN");
+        assertNotNull(columnValue);
+        assertEquals(now.toString(), new Time(columnValue.getTime()).toString());
+    }
+
+    public void testTIMESTAMP() throws Exception {
+        String columnName = "TIMESTAMP_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Date timestampValue = Calendar.getInstance().getTime();
+        test.setTimestampColumn(timestampValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(timestampValue.toString(), columnValue.toString());
+    }
+
+    public void testTIMESTAMP2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Date timestampValue = Calendar.getInstance().getTime();
+        test.setTimestampColumn(timestampValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Date columnValue = testRead.getTimestampColumn();
+        assertNotNull(columnValue);
+        assertEquals(Date.class, columnValue.getClass());
+        assertEquals(timestampValue.toString(), columnValue.toString());
+    }
+
+    public void testTINYINT() throws Exception {
+        String columnName = "TINYINT_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Byte tinyintValue = 89;
+        test.setTinyintColumn(tinyintValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(Byte.class, columnValue.getClass());
+        assertEquals(tinyintValue, columnValue);
+    }
+
+    public void testTINYINT2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        Byte tinyintValue = 89;
+        test.setTinyintColumn(tinyintValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        Byte columnValue = testRead.getTinyintColumn();
+        assertNotNull(columnValue);
+        assertEquals(Byte.class, columnValue.getClass());
+        assertEquals(tinyintValue, columnValue);
+    }
+
+    public void testVARBINARY() throws Exception {
+        String columnName = "VARBINARY_COLUMN";
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] varbinaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setVarbinaryColumn(varbinaryValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap2");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(varbinaryValue, (byte[]) columnValue));
+    }
+
+    public void testVARBINARY2() throws Exception {
+        ReturnTypesMap2 test = context.newObject(ReturnTypesMap2.class);
+
+        byte[] varbinaryValue = {
+                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
+        };
+        test.setVarbinaryColumn(varbinaryValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap2.class);
+        ReturnTypesMap2 testRead = (ReturnTypesMap2) context.performQuery(q).get(0);
+        byte[] columnValue = testRead.getVarbinaryColumn();
+        assertNotNull(columnValue);
+        assertEquals(byte[].class, columnValue.getClass());
+        assertTrue(Arrays.equals(varbinaryValue, columnValue));
+    }
+
+    public void testVARCHAR() throws Exception {
+        String columnName = "VARCHAR_COLUMN";
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        String varcharValue = "VARChar string for tests!";
+        test.setVarcharColumn(varcharValue);
+        context.commitChanges();
+
+        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
+        DataRow testRead = (DataRow) context.performQuery(q).get(0);
+        Object columnValue = testRead.get(columnName);
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(varcharValue, columnValue);
+    }
+
+    public void testVARCHAR2() throws Exception {
+        ReturnTypesMap1 test = context.newObject(ReturnTypesMap1.class);
+
+        String varcharValue = "VARChar string for tests!";
+        test.setVarcharColumn(varcharValue);
+        context.commitChanges();
+
+        SelectQuery q = new SelectQuery(ReturnTypesMap1.class);
+        ReturnTypesMap1 testRead = (ReturnTypesMap1) context.performQuery(q).get(0);
+        String columnValue = testRead.getVarcharColumn();
+        assertNotNull(columnValue);
+        assertEquals(String.class, columnValue.getClass());
+        assertEquals(varcharValue, columnValue);
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml?rev=899143&r1=899142&r2=899143&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/resources/testmap.map.xml Thu Jan 14 10:14:55 2010
@@ -234,6 +234,34 @@
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 		<db-attribute name="TINYINT_COL" type="TINYINT"/>
 	</db-entity>
+	<db-entity name="TYPES_MAPPING_TEST1">
+		<db-attribute name="AAAID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="BIGINT_COLUMN" type="BIGINT"/>
+		<db-attribute name="BIT_COLUMN" type="BIT"/>
+		<db-attribute name="BOOLEAN_COLUMN" type="BOOLEAN"/>
+		<db-attribute name="CHAR_COLUMN" type="CHAR" length="500"/>
+		<db-attribute name="CLOB_COLUMN" type="CLOB"/>
+		<db-attribute name="DATE_COLUMN" type="DATE"/>
+		<db-attribute name="DECIMAL_COLUMN" type="DECIMAL" length="12" scale="5"/>
+		<db-attribute name="DOUBLE_COLUMN" type="DOUBLE" scale="7"/>
+		<db-attribute name="FLOAT_COLUMN" type="FLOAT" scale="3"/>
+		<db-attribute name="INTEGER_COLUMN" type="INTEGER"/>
+		<db-attribute name="LONGVARCHAR_COLUMN" type="LONGVARCHAR"/>
+		<db-attribute name="NUMERIC_COLUMN" type="NUMERIC" length="12" scale="5"/>
+		<db-attribute name="REAL_COLUMN" type="REAL" scale="5"/>
+		<db-attribute name="SMALLINT_COLUMN" type="SMALLINT"/>
+		<db-attribute name="TIMESTAMP_COLUMN" type="TIMESTAMP"/>
+		<db-attribute name="TIME_COLUMN" type="TIME"/>
+		<db-attribute name="TINYINT_COLUMN" type="TINYINT"/>
+		<db-attribute name="VARCHAR_COLUMN" type="VARCHAR" length="1000"/>
+	</db-entity>
+	<db-entity name="TYPES_MAPPING_TEST2">
+		<db-attribute name="AAAID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
+		<db-attribute name="BINARY_COLUMN" type="BINARY" length="14"/>
+		<db-attribute name="BLOB_COLUMN" type="BLOB"/>
+		<db-attribute name="LONGVARBINARY_COLUMN" type="LONGVARBINARY"/>
+		<db-attribute name="VARBINARY_COLUMN" type="VARBINARY" length="1000"/>
+	</db-entity>
 	<db-entity name="UUID_TEST">
 		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true"/>
 		<db-attribute name="UUID" type="VARCHAR" length="100"/>
@@ -427,6 +455,32 @@
 		<obj-attribute name="paintingTitle" type="java.lang.String" db-attribute-path="PAINTING_TITLE"/>
 		<obj-attribute name="textReview" type="java.lang.String" db-attribute-path="toPaintingInfo.TEXT_REVIEW"/>
 	</obj-entity>
+	<obj-entity name="ReturnTypesMap1" className="org.apache.art.ReturnTypesMap1" clientClassName="test.client.ReturnTypesMap1" dbEntityName="TYPES_MAPPING_TEST1" superClassName="org.apache.cayenne.CayenneDataObject" clientSuperClassName="org.apache.cayenne.PersistentObject">
+		<obj-attribute name="bigintColumn" type="java.lang.Long" db-attribute-path="BIGINT_COLUMN"/>
+		<obj-attribute name="bitColumn" type="java.lang.Boolean" db-attribute-path="BIT_COLUMN"/>
+		<obj-attribute name="booleanColumn" type="java.lang.Boolean" db-attribute-path="BOOLEAN_COLUMN"/>
+		<obj-attribute name="charColumn" type="java.lang.String" db-attribute-path="CHAR_COLUMN"/>
+		<obj-attribute name="clobColumn" type="java.lang.String" db-attribute-path="CLOB_COLUMN"/>
+		<obj-attribute name="dateColumn" type="java.util.Date" db-attribute-path="DATE_COLUMN"/>
+		<obj-attribute name="decimalColumn" type="java.math.BigDecimal" db-attribute-path="DECIMAL_COLUMN"/>
+		<obj-attribute name="doubleColumn" type="java.lang.Double" db-attribute-path="DOUBLE_COLUMN"/>
+		<obj-attribute name="floatColumn" type="java.lang.Float" db-attribute-path="FLOAT_COLUMN"/>
+		<obj-attribute name="integerColumn" type="java.lang.Integer" db-attribute-path="INTEGER_COLUMN"/>
+		<obj-attribute name="longvarcharColumn" type="java.lang.String" db-attribute-path="LONGVARCHAR_COLUMN"/>
+		<obj-attribute name="numericColumn" type="java.math.BigDecimal" db-attribute-path="NUMERIC_COLUMN"/>
+		<obj-attribute name="realColumn" type="java.lang.Float" db-attribute-path="REAL_COLUMN"/>
+		<obj-attribute name="smallintColumn" type="java.lang.Short" db-attribute-path="SMALLINT_COLUMN"/>
+		<obj-attribute name="timeColumn" type="java.util.Date" db-attribute-path="TIME_COLUMN"/>
+		<obj-attribute name="timestampColumn" type="java.util.Date" db-attribute-path="TIMESTAMP_COLUMN"/>
+		<obj-attribute name="tinyintColumn" type="java.lang.Byte" db-attribute-path="TINYINT_COLUMN"/>
+		<obj-attribute name="varcharColumn" type="java.lang.String" db-attribute-path="VARCHAR_COLUMN"/>
+	</obj-entity>
+	<obj-entity name="ReturnTypesMap2" className="org.apache.art.ReturnTypesMap2" clientClassName="test.client.ReturnTypesMap2" dbEntityName="TYPES_MAPPING_TEST2" superClassName="org.apache.cayenne.CayenneDataObject" clientSuperClassName="org.apache.cayenne.PersistentObject">
+		<obj-attribute name="binaryColumn" type="byte[]" db-attribute-path="BINARY_COLUMN"/>
+		<obj-attribute name="blobColumn" type="byte[]" db-attribute-path="BLOB_COLUMN"/>
+		<obj-attribute name="longvarbinaryColumn" type="byte[]" db-attribute-path="LONGVARBINARY_COLUMN"/>
+		<obj-attribute name="varbinaryColumn" type="byte[]" db-attribute-path="VARBINARY_COLUMN"/>
+	</obj-entity>
 	<obj-entity name="SerializableEntity" className="org.apache.art.SerializableEntity" dbEntityName="SERIALIZABLE_ENTITY">
 		<obj-attribute name="serializableField" type="org.apache.cayenne.MockSerializable" db-attribute-path="SERIALIZABLE_FIELD"/>
 	</obj-entity>
@@ -638,6 +692,16 @@
 		<property name="cayenne.SQLTemplate.columnNameCapitalization" value="UPPER"/>
 		<sql><![CDATA[SELECT * FROM DATE_TEST]]></sql>
 	</query>
+	<query name="SelectReturnTypesMap1" factory="org.apache.cayenne.map.SQLTemplateBuilder" root="data-map" root-name="testmap">
+		<property name="cayenne.GenericSelectQuery.fetchingDataRows" value="true"/>
+		<property name="cayenne.SQLTemplate.columnNameCapitalization" value="UPPER"/>
+		<sql><![CDATA[SELECT * FROM TYPES_MAPPING_TEST1]]></sql>
+	</query>
+	<query name="SelectReturnTypesMap2" factory="org.apache.cayenne.map.SQLTemplateBuilder" root="data-map" root-name="testmap">
+		<property name="cayenne.GenericSelectQuery.fetchingDataRows" value="true"/>
+		<property name="cayenne.SQLTemplate.columnNameCapitalization" value="UPPER"/>
+		<sql><![CDATA[SELECT * FROM TYPES_MAPPING_TEST2]]></sql>
+	</query>
 	<query name="SelectTestLower" factory="org.apache.cayenne.map.SQLTemplateBuilder" root="data-map" root-name="testmap">
 		<property name="cayenne.GenericSelectQuery.fetchingDataRows" value="true"/>
 		<property name="cayenne.SQLTemplate.columnNameCapitalization" value="LOWER"/>



Mime
View raw message