cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r651839 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/
Date Sat, 26 Apr 2008 17:18:02 GMT
Author: aadamchik
Date: Sat Apr 26 10:18:00 2008
New Revision: 651839

URL: http://svn.apache.org/viewvc?rev=651839&view=rev
Log:
CAY-1014 Enums as meaningful PK

Added:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java
Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ProcedureAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/JDBCResultIteratorTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sat Apr 26 10:18:00 2008
@@ -47,6 +47,7 @@
 CAY-998 ROP paginated lists must recover from server LRU query cache overflow
 CAY-1003 the paged queries in ROP can fail to fetch the subsequent pages if the client and
server are in different timezones
 CAY-1005 CM Qualifier (or Declared Qualifier) is not honoured in 100% cases
+CAY-1014 Enums as meaningful PK
 CAY-1018 Enums fetched via SQLTemplate
 CAY-1020 Problem accessing toMany Set relationships on client.
 CAY-1028 NPE's in the Modeler for incomplete relationships

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/BatchAction.java
Sat Apr 26 10:18:00 2008
@@ -118,11 +118,11 @@
             while (query.next()) {
 
                 if (isLoggable) {
-                    QueryLogger.logQueryParameters
-                        ("batch bind",
-                         query.getDbAttributes(), 
-                         queryBuilder.getParameterValues(query),
-                         query instanceof InsertBatchQuery);
+                    QueryLogger.logQueryParameters(
+                            "batch bind",
+                            query.getDbAttributes(),
+                            queryBuilder.getParameterValues(query),
+                            query instanceof InsertBatchQuery);
                 }
 
                 queryBuilder.bindParameters(statement, query);
@@ -184,8 +184,11 @@
         try {
             while (query.next()) {
                 if (isLoggable) {
-                    QueryLogger.logQueryParameters
-                        ("bind", query.getDbAttributes(), queryBuilder.getParameterValues(query),
query instanceof InsertBatchQuery);
+                    QueryLogger.logQueryParameters(
+                            "bind",
+                            query.getDbAttributes(),
+                            queryBuilder.getParameterValues(query),
+                            query instanceof InsertBatchQuery);
                 }
 
                 queryBuilder.bindParameters(statement, query);
@@ -264,9 +267,13 @@
         // we can support multiple columns.. although need to check how well this works
         // with most common drivers)
 
+        RowDescriptorBuilder builder = new RowDescriptorBuilder();
+
         if (this.keyRowDescriptor == null) {
             // attempt to figure out the right descriptor from the mapping...
-            Collection<DbAttribute> generated = query.getDbEntity().getGeneratedAttributes();
+            Collection<DbAttribute> generated = query
+                    .getDbEntity()
+                    .getGeneratedAttributes();
             if (generated.size() == 1) {
                 DbAttribute key = generated.iterator().next();
 
@@ -277,13 +284,14 @@
                 columns[0] = new ColumnDescriptor(keysRS.getMetaData(), 1);
                 columns[0].setJdbcType(key.getType());
                 columns[0].setJavaClass(TypesMapping.getJavaBySqlType(key.getType()));
-                keyRowDescriptor = new RowDescriptor(columns, getAdapter()
-                        .getExtendedTypes());
+                builder.setColumns(columns);
             }
             else {
-                keyRowDescriptor = new RowDescriptor(keysRS, getAdapter()
-                        .getExtendedTypes());
+                builder.setResultSet(keysRS);
             }
+
+            this.keyRowDescriptor = builder
+                    .getDescriptor(getAdapter().getExtendedTypes());
         }
 
         ResultIterator iterator = new JDBCResultIterator(

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ProcedureAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ProcedureAction.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ProcedureAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/ProcedureAction.java
Sat Apr 26 10:18:00 2008
@@ -143,28 +143,36 @@
      * @param resultSet JDBC ResultSet
      * @param setIndex a zero-based index of the ResultSet in the query results.
      */
-    protected RowDescriptor describeResultSet(ResultSet resultSet, int setIndex) {
+    protected RowDescriptor describeResultSet(ResultSet resultSet, int setIndex)
+            throws SQLException {
+
         if (setIndex < 0) {
             throw new IllegalArgumentException(
                     "Expected a non-negative result set index. Got: " + setIndex);
         }
 
+        RowDescriptorBuilder builder = new RowDescriptorBuilder();
+
         List<ColumnDescriptor[]> descriptors = query.getResultDescriptors();
 
         if (descriptors.isEmpty()) {
-            // failover to default JDBC result descriptor
-            return new RowDescriptor(resultSet, getAdapter().getExtendedTypes());
+            builder.setResultSet(resultSet);
         }
+        else {
 
-        // if one result is described, all of them must be present...
-        if (setIndex >= descriptors.size() || descriptors.get(setIndex) == null) {
-            throw new CayenneRuntimeException("No descriptor for result set at index '"
-                    + setIndex
-                    + "' configured.");
-        }
+            // if one result is described, all of them must be present...
+            if (setIndex >= descriptors.size() || descriptors.get(setIndex) == null) {
+                throw new CayenneRuntimeException(
+                        "No descriptor for result set at index '"
+                                + setIndex
+                                + "' configured.");
+            }
 
-        ColumnDescriptor[] columns = descriptors.get(setIndex);
-        return new RowDescriptor(columns, getAdapter().getExtendedTypes());
+            ColumnDescriptor[] columns = descriptors.get(setIndex);
+            builder.setColumns(columns);
+        }
+        
+        return builder.getDescriptor(getAdapter().getExtendedTypes());
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptor.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptor.java
Sat Apr 26 10:18:00 2008
@@ -34,7 +34,6 @@
  * @since 1.2
  * @author Andrus Adamchik
  */
-// replaces 1.1 ResultDescriptor
 public class RowDescriptor {
 
     protected ColumnDescriptor[] columns;
@@ -48,7 +47,19 @@
     }
 
     /**
+     * Creates a fully initialized RowDescriptor.
+     * 
+     * @since 3.0
+     */
+    public RowDescriptor(ColumnDescriptor[] columns, ExtendedType[] converters) {
+        this.columns = columns;
+        this.converters = converters;
+    }
+
+    /**
      * Creates a RowDescriptor for an array of columns.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     public RowDescriptor(ColumnDescriptor[] columns, ExtendedTypeMap types) {
         this.columns = columns;
@@ -57,6 +68,8 @@
 
     /**
      * Creates new RowDescriptor using ResultSet metadata to determine the columns.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     public RowDescriptor(ResultSet resultSet, ExtendedTypeMap types) {
         this(resultSet, types, null);
@@ -66,6 +79,8 @@
      * Creates new RowDescriptor using ResultSet metadata to determine the columns. Note
      * that if javaTypeOverrides array is null, default JDBC to Java types mapping is
      * used.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     public RowDescriptor(ResultSet resultSet, ExtendedTypeMap types, Map javaTypeOverrides)
{
 
@@ -77,31 +92,11 @@
 
         indexTypes(types);
     }
-    
-    /**
-     * Converts result column labels to uppercase using the default Locale.
-     * 
-     * @since 3.0 
-     */
-    public void forceUpperCaseColumnNames() {
-        for (ColumnDescriptor column : columns) {
-            column.setLabel(column.getLabel().toUpperCase());
-        }
-    }
-    
-    /**
-     * Converts result column labels to lowercase using the default Locale.
-     * 
-     * @since 3.0 
-     */
-    public void forceLowerCaseColumnNames() {
-        for (ColumnDescriptor column : columns) {
-            column.setLabel(column.getLabel().toLowerCase());
-        }
-    }
 
     /**
      * Initializes converters for columns.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     protected void indexTypes(ExtendedTypeMap types) {
         this.converters = new ExtendedType[columns.length];
@@ -112,6 +107,8 @@
 
     /**
      * Builds columns list from ResultSet metadata.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     protected void initFromResultSet(ResultSet resultSet) {
         try {
@@ -135,6 +132,8 @@
     /**
      * Overrides Java types of result columns. Keys in the map must correspond to the
      * names of the columns.
+     * 
+     * @deprecated since 3.0 use {@link RowDescriptorBuilder}.
      */
     protected void overrideJavaTypes(Map overrides) {
 

Added: 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=651839&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java
(added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/RowDescriptorBuilder.java
Sat Apr 26 10:18:00 2008
@@ -0,0 +1,199 @@
+/*****************************************************************
+ *   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.jdbc;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.cayenne.CayenneRuntimeException;
+import org.apache.cayenne.access.types.ExtendedType;
+import org.apache.cayenne.access.types.ExtendedTypeMap;
+import org.apache.commons.collections.Transformer;
+
+/**
+ * A builder class that helps to assemble {@link RowDescriptor} instances from various
+ * types of inputs.
+ * 
+ * @since 3.0
+ * @author Andrus Adamchik
+ */
+public class RowDescriptorBuilder {
+
+    private static final Transformer UPPERCASE_TRANSFORMER = new Transformer() {
+
+        public Object transform(Object input) {
+            return input != null ? input.toString().toUpperCase() : null;
+        }
+    };
+
+    private static final Transformer LOWERCASE_TRANSFORMER = new Transformer() {
+
+        public Object transform(Object input) {
+            return input != null ? input.toString().toLowerCase() : null;
+        }
+    };
+
+    protected ColumnDescriptor[] columns;
+    protected ResultSetMetaData resultSetMetadata;
+
+    protected Transformer caseTransformer;
+    protected Map<String, String> typeOverrides;
+
+    /**
+     * Returns a RowDescriptor built based on the builder internal state.
+     */
+    public RowDescriptor getDescriptor(ExtendedTypeMap typeMap) throws SQLException,
+            IllegalStateException {
+
+        // explicitly-set columns take precedence over the columns derived from
+        // ResultSetMetadata
+
+        ColumnDescriptor[] columns;
+
+        if (this.columns != null) {
+            columns = columnsFromPresetColumns();
+        }
+        else if (this.resultSetMetadata != null) {
+            columns = columnsFromResultSet();
+        }
+        else {
+            throw new IllegalStateException(
+                    "Can't build RowDescriptor, both 'columns' and 'resultSetMetadata' are
null");
+        }
+
+        ExtendedType[] converters = new ExtendedType[columns.length];
+        for (int i = 0; i < columns.length; i++) {
+            converters[i] = typeMap.getRegisteredType(columns[i].getJavaClass());
+        }
+
+        return new RowDescriptor(columns, converters);
+    }
+
+    protected ColumnDescriptor[] columnsFromPresetColumns() {
+        int len = columns.length;
+
+        if (caseTransformer != null) {
+            for (int i = 0; i < len; i++) {
+
+                String oldLabel = columns[i].getLabel();
+                String oldName = columns[i].getName();
+
+                String newLabel = (String) caseTransformer.transform(oldLabel);
+                columns[i].setLabel(newLabel);
+
+                // do we even need to check this?
+                if (oldName.equals(oldLabel)) {
+                    columns[i].setName(newLabel);
+                }
+            }
+        }
+
+        if (typeOverrides != null) {
+            for (int i = 0; i < len; i++) {
+
+                String type = typeOverrides.get(columns[i].getName());
+
+                if (type != null) {
+                    columns[i].setJavaClass(type);
+                }
+            }
+        }
+
+        return this.columns;
+    }
+
+    protected ColumnDescriptor[] columnsFromResultSet() throws SQLException {
+
+        int len = resultSetMetadata.getColumnCount();
+        if (len == 0) {
+            throw new CayenneRuntimeException("No columns in ResultSet.");
+        }
+
+        ColumnDescriptor[] columns = new ColumnDescriptor[len];
+
+        for (int i = 0; i < len; i++) {
+
+            int position = i + 1;
+            String name = resultSetMetadata.getColumnLabel(position);
+            if (name == null || name.length() == 0) {
+                name = resultSetMetadata.getColumnName(position);
+
+                if (name == null || name.length() == 0) {
+                    name = "column_" + position;
+                }
+            }
+
+            if (caseTransformer != null) {
+                name = (String) caseTransformer.transform(name);
+            }
+
+            int jdbcType = resultSetMetadata.getColumnType(position);
+
+            String javaClass = null;
+            if (typeOverrides != null) {
+                javaClass = typeOverrides.get(name);
+            }
+
+            if (javaClass == null) {
+                javaClass = resultSetMetadata.getColumnClassName(position);
+            }
+
+            columns[i] = new ColumnDescriptor(name, jdbcType, javaClass);
+        }
+
+        return columns;
+    }
+
+    /**
+     * Sets an explicit set of columns. Note that the array passed as an argument can
+     * later be modified by the build to enforce column capitalization policy and columns
+     * Java types overrides.
+     */
+    public RowDescriptorBuilder setColumns(ColumnDescriptor[] columns) {
+        this.columns = columns;
+        return this;
+    }
+
+    public RowDescriptorBuilder setResultSet(ResultSet resultSet) throws SQLException {
+        this.resultSetMetadata = resultSet.getMetaData();
+        return this;
+    }
+
+    public RowDescriptorBuilder useLowercaseColumnNames() {
+        this.caseTransformer = LOWERCASE_TRANSFORMER;
+        return this;
+    }
+
+    public RowDescriptorBuilder useUppercaseColumnNames() {
+        this.caseTransformer = UPPERCASE_TRANSFORMER;
+        return this;
+    }
+
+    public RowDescriptorBuilder overrideColumnType(String columnName, String type) {
+        if (typeOverrides == null) {
+            typeOverrides = new HashMap<String, String>();
+        }
+
+        typeOverrides.put(columnName, type);
+        return this;
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
Sat Apr 26 10:18:00 2008
@@ -28,7 +28,6 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -219,40 +218,39 @@
         boolean iteratedResult = callback.isIteratedResult();
 
         ExtendedTypeMap types = adapter.getExtendedTypes();
-        RowDescriptor descriptor;
+        RowDescriptorBuilder builder = new RowDescriptorBuilder();
 
         // SQLTemplate #result columns take precedence over other ways to determine the
         // type
         if (compiled.getResultColumns().length > 0) {
-            descriptor = new RowDescriptor(compiled.getResultColumns(), types);
+            builder.setColumns(compiled.getResultColumns());
         }
-        else if (entity != null) {
-            Map<String, String> typeOverrides = new HashMap<String, String>();
+        else {
+            builder.setResultSet(resultSet);
 
-            // TODO: andrus 2008/03/28 support flattened attributes with aliases...
-            for (ObjAttribute attribute : entity.getAttributes()) {
-                String column = attribute.getDbAttributePath();
-                if (column == null || column.indexOf('.') > 0) {
-                    continue;
-                }
+            if (entity != null) {
+
+                // TODO: andrus 2008/03/28 support flattened attributes with aliases...
+                for (ObjAttribute attribute : entity.getAttributes()) {
+                    String column = attribute.getDbAttributePath();
+                    if (column == null || column.indexOf('.') > 0) {
+                        continue;
+                    }
 
-                typeOverrides.put(column, attribute.getType());
+                    builder.overrideColumnType(column, attribute.getType());
+                }
             }
 
-            descriptor = new RowDescriptor(resultSet, types, typeOverrides);
-        }
-        else {
-            descriptor = new RowDescriptor(resultSet, types);
         }
 
         if (query.getColumnNamesCapitalization() != null) {
             if (SQLTemplate.LOWERCASE_COLUMN_NAMES.equals(query
                     .getColumnNamesCapitalization())) {
-                descriptor.forceLowerCaseColumnNames();
+                builder.useLowercaseColumnNames();
             }
             else if (SQLTemplate.UPPERCASE_COLUMN_NAMES.equals(query
                     .getColumnNamesCapitalization())) {
-                descriptor.forceUpperCaseColumnNames();
+                builder.useUppercaseColumnNames();
             }
         }
 
@@ -260,7 +258,7 @@
                 connection,
                 statement,
                 resultSet,
-                descriptor,
+                builder.getDescriptor(types),
                 query.getFetchLimit());
 
         if (!iteratedResult) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SelectAction.java
Sat Apr 26 10:18:00 2008
@@ -72,8 +72,8 @@
         PreparedStatement prepStmt = translator.createStatement();
         ResultSet rs = prepStmt.executeQuery();
 
-        RowDescriptor descriptor = new RowDescriptor(
-                translator.getResultColumns(),
+        RowDescriptor descriptor = new RowDescriptorBuilder().setColumns(
+                translator.getResultColumns()).getDescriptor(
                 getAdapter().getExtendedTypes());
         JDBCResultIterator workerIterator = new JDBCResultIterator(
                 connection,

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/JDBCResultIteratorTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/JDBCResultIteratorTest.java?rev=651839&r1=651838&r2=651839&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/JDBCResultIteratorTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/JDBCResultIteratorTest.java
Sat Apr 26 10:18:00 2008
@@ -63,7 +63,9 @@
         rs.addColumn("a", new Object[] {
                 "1", "2", "3"
         });
-        RowDescriptor descriptor = new RowDescriptor(rs, new ExtendedTypeMap());
+        RowDescriptor descriptor = new RowDescriptorBuilder()
+                .setResultSet(rs)
+                .getDescriptor(new ExtendedTypeMap());
 
         JDBCResultIterator it = new JDBCResultIterator(c, s, rs, descriptor, 0);
 
@@ -88,7 +90,9 @@
                 "1", "2", "3"
         });
 
-        RowDescriptor descriptor = new RowDescriptor(rs, new ExtendedTypeMap());
+        RowDescriptor descriptor = new RowDescriptorBuilder()
+                .setResultSet(rs)
+                .getDescriptor(new ExtendedTypeMap());
         return new JDBCResultIterator(c, s, rs, descriptor, 0);
     }
 



Mime
View raw message