db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1028130 [4/6] - in /db/torque/torque4/branches/trunk-without-village: torque-runtime/ torque-runtime/src/main/java/org/apache/torque/map/ torque-runtime/src/main/java/org/apache/torque/oid/ torque-runtime/src/main/java/org/apache/torque/om...
Date Wed, 27 Oct 2010 22:52:18 GMT
Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMForeignKeyTransformer.java Wed Oct 27 22:52:15 2010
@@ -22,8 +22,10 @@ package org.apache.torque.templates.tran
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.torque.generator.GeneratorException;
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.source.SourceElement;
+import org.apache.torque.generator.source.SourcePath;
 import org.apache.torque.generator.source.transform.SourceTransformerException;
 import org.apache.torque.templates.TorqueSchemaAttributeName;
 import org.apache.torque.templates.TorqueSchemaElementName;
@@ -140,7 +142,7 @@ public class OMForeignKeyTransformer
         String foreignTableName = (String) foreignKey.getAttribute(
                 TorqueSchemaAttributeName.FOREIGN_TABLE);
         SourceElement foreignTable
-                = FindHelper.findTable(database, foreignTableName);
+                = FindHelper.findTable(database, foreignTableName, true);
         foreignKey.getChildren().add(foreignTable);
 
         for (SourceElement reference : foreignKey.getChildren(
@@ -150,19 +152,22 @@ public class OMForeignKeyTransformer
             createForeignElementForReference(foreignTable, reference);
         }
 
-        // create reference only if this table was not loaded from
-        // an external schema
-        if (localTable.getAttribute(TableAttributeName.FROM_EXTERNAL_SCHEMA)
-                == null)
+        StringBuilder localParentPath = new StringBuilder();
+        getParentPath(localTable, localParentPath);
+
+        StringBuilder foreignParentPath = new StringBuilder();
+        getParentPath(foreignTable, foreignParentPath);
+        // create reference only if this table is not in a external-schema
+        // element of the foreign table's database
+        if (foreignParentPath.toString().startsWith(localParentPath.toString()))
         {
             addLocalField(foreignKey, controllerState);
             addLocalFieldInBean(foreignKey, controllerState);
         }
 
-        // create backreference only if the foreign table was not loaded from
-        // an external schema
-        if (foreignTable.getAttribute(TableAttributeName.FROM_EXTERNAL_SCHEMA)
-                == null)
+        // create backreference only if the foreign table is not
+        // in a external-schema element of this table's database
+        if (localParentPath.toString().startsWith(foreignParentPath.toString()))
         {
             addForeignField(foreignKey, controllerState);
             addForeignFieldInBean(foreignKey, controllerState);
@@ -719,4 +724,25 @@ public class OMForeignKeyTransformer
             reference.getChildren().add(localColumnElement);
         }
     }
+
+    private void getParentPath(
+            SourceElement sourceElement,
+            StringBuilder result)
+    {
+        SourceElement parent = sourceElement.getParent();
+        if (parent == null)
+        {
+            return;
+        }
+        result.append(parent.getName());
+        if (TorqueSchemaElementName.EXTERNAL_SCHEMA.getName().equals(
+                parent.getName()))
+        {
+            result.append("[")
+                .append(parent.getAttribute(TorqueSchemaAttributeName.FILENAME))
+                .append("]");
+        }
+        result.append("/");
+        getParentPath(parent, result);
+    }
 }

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java Wed Oct 27 22:52:15 2010
@@ -25,6 +25,7 @@ import java.util.List;
 import org.apache.commons.lang.StringUtils;
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.processor.string.Camelbacker;
+import org.apache.torque.generator.processor.string.WrapReservedJavaWords;
 import org.apache.torque.generator.source.SourceElement;
 import org.apache.torque.generator.source.transform.AttributeTransformer;
 import org.apache.torque.generator.source.transform.SourceTransformerException;
@@ -56,6 +57,10 @@ public class OMTableTransformer extends 
     /** The Camelbacker for producing the java name from the table name. */
     private static Camelbacker javaNameCamelbacker = new Camelbacker();
 
+    /** Prevents reserved java words. */
+    private static WrapReservedJavaWords reservedJavaWordsWrapper
+            = new WrapReservedJavaWords();
+
     public OMTableTransformer() throws SourceTransformerException
     {
         super(new InputStreamReader(
@@ -71,6 +76,7 @@ public class OMTableTransformer extends 
     {
         checkElementName(tableElement);
         setJavaNameAttribute(tableElement);
+        setFieldNameAttribute(tableElement);
         setIdMethodAttribute(tableElement);
         setSequenceAttributeIfNecessary(tableElement);
         setBaseClass(tableElement, controllerState);
@@ -349,4 +355,28 @@ public class OMTableTransformer extends 
                 TorqueSchemaAttributeName.BASE_CLASS,
                 baseClass);
     }
+
+    /**
+     * Sets the fieldName attribute of the table element if it is not
+     * already set. The field name can be used to contain a database object
+     * corresponding to the table.
+     * The javaName attribute of the column must be set.
+     *
+     * @param tableElement the table element, not null.
+     */
+    protected void setFieldNameAttribute(SourceElement tableElement)
+    {
+        if (tableElement.getAttribute(JavaFieldAttributeName.FIELD_NAME)
+                != null)
+        {
+            return;
+        }
+        String javaName = (String) tableElement.getAttribute(
+                TorqueSchemaAttributeName.JAVA_NAME);
+        String fieldName = StringUtils.uncapitalize(javaName);
+        fieldName = reservedJavaWordsWrapper.process(fieldName);
+        tableElement.setAttribute(
+                JavaFieldAttributeName.FIELD_NAME,
+                fieldName);
+    }
 }

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java Wed Oct 27 22:52:15 2010
@@ -104,28 +104,31 @@ public class OMTransformer implements So
     {
         TemplateOptionName.checkRequiredOptions(controllerState);
 
+        // load referenced external schemata
         loadExternalSchemaTransformer.transform(root, controllerState);
-
-        for (SourceElement tableElement : root.getChildren(
-                TorqueSchemaElementName.TABLE.getName()))
+        
+        SourceElement allTablesRoot 
+                = root.getChild(DatabaseChildElementName.ALL_TABLES);
+        for (SourceElement tableElement : allTablesRoot.getChildren(
+                TorqueSchemaElementName.TABLE))
         {
             tableTransformer.transform(
                     tableElement,
                     controllerState);
         }
 
-        for (SourceElement tableElement : root.getChildren(
-                TorqueSchemaElementName.TABLE.getName()))
+        for (SourceElement tableElement : allTablesRoot.getChildren(
+                TorqueSchemaElementName.TABLE))
         {
             for (SourceElement columnElement : tableElement.getChildren(
-                    TorqueSchemaElementName.COLUMN.getName()))
+                    TorqueSchemaElementName.COLUMN))
             {
                 foreignKeyColumnTransformer.transform(
                         columnElement,
                         controllerState);
             }
             for (SourceElement foreignKeyElement : tableElement.getChildren(
-                    TorqueSchemaElementName.FOREIGN_KEY.getName()))
+                    TorqueSchemaElementName.FOREIGN_KEY))
             {
                 foreignKeyTransformer.transform(
                         foreignKeyElement,

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java Wed Oct 27 22:52:15 2010
@@ -60,12 +60,7 @@ public enum TableAttributeName implement
     /**
      * The package name of the bean class.
      */
-    BEAN_PACKAGE("beanPackage"),
-
-    /**
-     * The file name of the external schema from which this Element stems.
-     */
-    FROM_EXTERNAL_SCHEMA("fromExternalSchema");
+    BEAN_PACKAGE("beanPackage");
 
     /** The name of the source element attribute, not null. */
     private String name;

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java Wed Oct 27 22:52:15 2010
@@ -25,7 +25,6 @@ import java.util.List;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.torque.generator.control.ControllerState;
-import org.apache.torque.generator.jdbc.SchemaType;
 import org.apache.torque.generator.source.SourceElement;
 import org.apache.torque.generator.source.SourcePath;
 import org.apache.torque.generator.source.transform.SourceTransformer;
@@ -39,6 +38,7 @@ import org.apache.torque.templates.platf
 import org.apache.torque.templates.transformer.CollectAttributeSetTrueTransformer;
 import org.apache.torque.templates.transformer.SchemaTypeHelper;
 import org.apache.torque.templates.transformer.om.TableChildElementName;
+import org.apache.torque.templates.typemapping.SchemaType;
 import org.apache.torque.templates.typemapping.SqlType;
 import org.apache.torque.templates.typemapping.TypeMap;
 

Added: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java?rev=1028130&view=auto
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java (added)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/ResultSetGetter.java Wed Oct 27 22:52:15 2010
@@ -0,0 +1,131 @@
+package org.apache.torque.templates.typemapping;
+
+
+/*
+ * 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.
+ */
+
+/**
+ * All available result set getter methods.
+ *
+ * $Id: $
+ */
+public enum ResultSetGetter
+{
+    /** getArray Method. */
+    ARRAY("getArray"),
+    /** getAsciiStream Method. */
+    ASCII_STREAM("getAsciiStream"),
+    /** getBigDecimal Method. */
+    BIG_DECIMAL("getBigDecimal"),
+    /** getBinaryStream Method. */
+    BINARY_STREAM("getBinaryStream"),
+    /** getBlob Method. */
+    BLOB("getBlob"),
+    /** getBoolean Method. */
+    BOOLEAN("getBoolean"),
+    /** getByte Method. */
+    BYTE("getByte"),
+    /** getBytes Method. */
+    BYTES("getBytes"),
+    /** getCharacterStream Method. */
+    CHARACTER_STREAM("getCharacterStream"),
+    /** getClob Method. */
+    CLOB("getClob"),
+    /** getDate Method. */
+    DATE("getDate"),
+    /** getDouble Method. */
+    DOUBLE("getDouble"),
+    /** getFloat Method. */
+    FLOAT("getFloat"),
+    /** getInt Method. */
+    INT("getInt"),
+    /** getLong Method. */
+    LONG("getLong"),
+    /** getObject Method. */
+    OBJECT("getObject"),
+    /** getRef Method. */
+    REF("getRef"),
+    /** getShort Method. */
+    SHORT("getShort"),
+    /** getString Method. */
+    STRING("getString"),
+    /** getTime Method. */
+    TIME("getTime"),
+    /** getTimestamp Method. */
+    TIMESTAMP("getTimestamp"),
+    /** getUnicodeStream Method. */
+    UNICODE_STREAM("getUnicodeStream"),
+    /** getURL Method. */
+    URL("getURL");
+
+    /** The method name. */
+    private String method;
+
+    /**
+     * Constructor.
+     *
+     * @param method the method name, not null.
+     */
+    private ResultSetGetter(String method)
+    {
+        this.method = method;
+    }
+
+    /**
+     * Returns the method name.
+     *
+     * @return the method name, not null.
+     */
+    public String getMethod()
+    {
+        return method;
+    }
+
+    /**
+     * Returns the method name.
+     *
+     * @return the method name, not null.
+     */
+    public String toString()
+    {
+        return method;
+    }
+
+    /**
+     * Retursn the ResultSetGetter with the given method name.
+     *
+     * @param methodName the method name.
+     *
+     * @return the matching ResultSetGetter, not null.
+     *
+     * @throws IllegalArgumentException if no matching ResultSetGetter
+     *         exists.
+     */
+    public static ResultSetGetter getByMethodName(String methodName)
+    {
+        for (ResultSetGetter resultSetGetter : values())
+        {
+            if (resultSetGetter.getMethod().equals(methodName))
+            {
+                return resultSetGetter;
+            }
+        }
+        throw new IllegalArgumentException("Unknown value " + methodName);
+    }
+}

Added: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SchemaType.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SchemaType.java?rev=1028130&view=auto
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SchemaType.java (added)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SchemaType.java Wed Oct 27 22:52:15 2010
@@ -0,0 +1,114 @@
+package org.apache.torque.templates.typemapping;
+
+/*
+ * 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.
+ */
+
+import java.sql.Types;
+
+/**
+ * Enum for known SQL types.
+ *
+ * @author <a href="mailto:mpoeschl@marmot.at>Martin Poeschl</a>
+ * @version $Id: SchemaType.java 473814 2006-11-11 22:30:30 +0000 (Sat, 11 Nov 2006) tv $
+ */
+public enum SchemaType
+{
+    /** JDBC Datatype BIT. */
+    BIT(Types.BIT),
+    /** JDBC Datatype TINYINT. */
+    TINYINT(Types.TINYINT),
+    /** JDBC Datatype SMALLINT. */
+    SMALLINT(Types.SMALLINT),
+    /** JDBC Datatype INTEGER. */
+    INTEGER(Types.INTEGER),
+    /** JDBC Datatype BIGINT. */
+    BIGINT(Types.BIGINT),
+    /** JDBC Datatype FLOAT. */
+    FLOAT(Types.FLOAT),
+    /** JDBC Datatype REAL. */
+    REAL(Types.REAL),
+    /** JDBC Datatype NUMERIC. */
+    NUMERIC(Types.NUMERIC),
+    /** JDBC Datatype DECIMAL. */
+    DECIMAL(Types.DECIMAL),
+    /** JDBC Datatype CHAR. */
+    CHAR(Types.CHAR),
+    /** JDBC Datatype VARCHAR. */
+    VARCHAR(Types.VARCHAR),
+    /** JDBC Datatype LONGVARCHAR. */
+    LONGVARCHAR(Types.LONGVARCHAR),
+    /** JDBC Datatype DATE. */
+    DATE(Types.DATE),
+    /** JDBC Datatype TIME. */
+    TIME(Types.TIME),
+    /** JDBC Datatype TIMESTAMP. */
+    TIMESTAMP(Types.TIMESTAMP),
+    /** JDBC Datatype BINARY. */
+    BINARY(Types.BINARY),
+    /** JDBC Datatype VARBINARY. */
+    VARBINARY(Types.VARBINARY),
+    /** JDBC Datatype LONGVARBINARY. */
+    LONGVARBINARY(Types.LONGVARBINARY),
+    /** JDBC Datatype NULL. */
+    NULL(Types.NULL),
+    /** JDBC Datatype OTHER. */
+    OTHER(Types.OTHER),
+    /** JDBC Datatype JAVA_OBJECT. */
+    JAVA_OBJECT(Types.JAVA_OBJECT),
+    /** JDBC Datatype DISTINCT. */
+    DISTINCT(Types.DISTINCT),
+    /** JDBC Datatype STRUCT. */
+    STRUCT(Types.STRUCT),
+    /** JDBC Datatype ARRAY. */
+    ARRAY(Types.ARRAY),
+    /** JDBC Datatype BLOB. */
+    BLOB(Types.BLOB),
+    /** JDBC Datatype CLOB. */
+    CLOB(Types.CLOB),
+    /** JDBC Datatype REF. */
+    REF(Types.REF),
+    /** JDBC Datatype INTEGER interpreted as Boolean. */
+    BOOLEANINT(Types.INTEGER),
+    /** JDBC Datatype CHAR interpreted as Boolean. */
+    BOOLEANCHAR(Types.CHAR),
+    /** JDBC Datatype DOUBLE. */
+    DOUBLE(Types.DOUBLE);
+
+    /**
+     * The corresponding jdbc type,
+     * may be null if no corresponding type exists.
+     */
+    private Integer jdbcType;
+
+    private SchemaType(Integer jdbcType)
+    {
+        this.jdbcType = jdbcType;
+    }
+
+    /**
+     * Returns the corresponding jdbc type.
+     *
+     * @return the corresponding jdbc type, or null if no corresponding
+     *         type exists.
+     */
+    public Integer getJdbcType()
+    {
+        return jdbcType;
+    }
+}

Added: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlTypeWithJdbcType.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlTypeWithJdbcType.java?rev=1028130&view=auto
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlTypeWithJdbcType.java (added)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/SqlTypeWithJdbcType.java Wed Oct 27 22:52:15 2010
@@ -0,0 +1,276 @@
+package org.apache.torque.templates.typemapping;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.lang.StringUtils;
+
+/*
+ * 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.
+ */
+
+
+/**
+ * The SQL type data for a column. Can contain additional information such as
+ * default size, scale and defaultValue.
+ * This class is immutable.
+ *
+ * @version $Id: Domain.java 473814 2006-11-11 22:30:30 +0000 (Sat, 11 Nov 2006) tv $
+ */
+public class SqlTypeWithJdbcType
+{
+    /**
+     * The default size for the columns with this type
+     * (can be overridden in the column definition).
+     */
+    private String size;
+
+    /**
+     * The default scale for the columns with this type
+     * (can be overridden in the column definition).
+     */
+    private String scale;
+
+    /**
+     * The default "default value" for the columns with this type
+     * (can be overridden in the column definition).
+     */
+    private String defaultValue;
+
+    /**
+     * The SQL expression for the type name, not null.
+     */
+    private String sqlTypeName;
+    
+    /**
+     * The jdbc type as in <code>java.sql.types</code>
+     */
+    private int jdbcType;
+
+    /**
+     * Creates a new SqlType with the given SQL Type.
+     * Size, scale and defaultValue are set to null.
+     *
+     * @param sqlType the SQL name of the SQL type, not null.
+     * @param jdbcType the jdbc type as in <code>java.sql.types</code>.
+     *
+     * @throws NullPointerException if sqlTypeName is null.
+     */
+    public SqlTypeWithJdbcType(String sqlTypeName, int jdbcType)
+    {
+        if (sqlTypeName == null)
+        {
+            throw new NullPointerException("sqlTypeName must not be null");
+        }
+        this.sqlTypeName = sqlTypeName;
+        this.jdbcType = jdbcType;
+    }
+
+    /**
+     * Creates a new SqlType with null scale and null default value.
+     *
+     * @param sqlTypeName the SQL name of the SQL type, not null.
+     * @param jdbcType the jdbc type as in <code>java.sql.types</code>.
+     * @param size the default size of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     *
+     * @throws NullPointerException if sqlTypeName is null.
+     */
+    public SqlTypeWithJdbcType(
+            String sqlTypeName,
+            int jdbcType,
+            String size)
+    {
+        this(sqlTypeName, jdbcType);
+        this.size = size;
+    }
+
+    /**
+     * Creates a new SqlType with null default value.
+     *
+     * @param sqlTypeName the SQL name of the SQL type, not null.
+     * @param jdbcType the jdbc type as in <code>java.sql.types</code>.
+     * @param size the default size of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     * @param scale the default scale of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     *
+     * @throws NullPointerException if sqlTypeName is null.
+     */
+    public SqlTypeWithJdbcType(
+            String sqlTypeName,
+            int jdbcType,
+            String size,
+            String scale)
+    {
+        this(sqlTypeName, jdbcType, size);
+        this.scale = scale;
+    }
+
+    /**
+     * Creates a new SqlType.
+     *
+     * @param sqlTypeName the SQL name of the SQL type, not null.
+     * @param jdbcType the jdbc type as in <code>java.sql.types</code>.
+     * @param size the default size of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     * @param scale the default scale of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     * @param defaultValue the default "default value" of the columns with this
+     *        SQL type. Can be overridden in the column definition.
+     *
+     * @throws NullPointerException if sqlTypeName is null.
+     */
+    public SqlTypeWithJdbcType(
+            String sqlTypeName,
+            int jdbcType,
+            String size,
+            String scale,
+            String defaultValue)
+    {
+        this(sqlTypeName, jdbcType, size, scale);
+        this.defaultValue = defaultValue;
+    }
+
+    /**
+     * Creates a new SqlType by copying another sql type.
+     *
+     * @param sqlType the SQL type, to copy, not null.
+     * @param size the default size of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     *        If null, the size from sqlType is used.
+     * @param scale the default scale of the columns with this SQL type.
+     *        Can be overridden in the column definition.
+     *        If null, the scale from sqlType is used.
+     * @param defaultValue the default "default value" of the columns with this
+     *        SQL type. Can be overridden in the column definition.
+     *        If null, the defaultValue from sqlType is used.
+     *
+     * @throws NullPointerException if sqlType is null.
+     */
+    public SqlTypeWithJdbcType(
+            SqlTypeWithJdbcType sqlType,
+            String size,
+            String scale,
+            String defaultValue)
+    {
+        this(sqlType.getSqlTypeName(), sqlType.getJdbcType());
+        if (size != null)
+        {
+            this.size = size;
+        }
+        else
+        {
+            this.size = sqlType.getSize();
+        }
+        if (scale != null)
+        {
+            this.scale = scale;
+        }
+        else
+        {
+            this.scale = sqlType.getScale();
+        }
+        if (defaultValue != null)
+        {
+            this.defaultValue = defaultValue;
+        }
+        else
+        {
+            this.defaultValue = sqlType.getDefaultValue();
+        }
+    }
+
+    /**
+     * @return Returns the scale.
+     */
+    public String getScale()
+    {
+        return scale;
+    }
+
+    /**
+     * @return Returns the size.
+     */
+    public String getSize()
+    {
+        return size;
+    }
+
+    /**
+     * @return Returns the defaultValue.
+     */
+    public String getDefaultValue()
+    {
+        return defaultValue;
+    }
+
+    /**
+     * @return Returns the SQL type name for this column type.
+     */
+    public String getSqlTypeName()
+    {
+        return sqlTypeName;
+    }
+
+    /**
+     * @return Returns the jdbc type tas in <code>java.sql.types</code>.
+     */
+    public int getJdbcType()
+    {
+        return jdbcType;
+    }
+
+    /**
+     * Return the size and scale in brackets for use in an SQL script.
+     *
+     * @return size and scale or an empty String if there are no values
+     *         available.
+     */
+    public String printSize()
+    {
+        if (StringUtils.isNotBlank(size) && StringUtils.isNotBlank(scale))
+        {
+            return '(' + size + ',' + scale + ')';
+        }
+        else if (StringUtils.isNotBlank(size))
+        {
+            return '(' + size + ')';
+        }
+        else
+        {
+            return "";
+        }
+    }
+}

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/java/org/apache/torque/templates/typemapping/TypeMap.java Wed Oct 27 22:52:15 2010
@@ -25,8 +25,6 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.torque.generator.jdbc.SchemaType;
-
 /**
  * Various mappings for schema types, e.g. to their corresponding
  * Java object types, and Java native types.
@@ -136,19 +134,12 @@ public final class TypeMap
     private static final Map<SchemaType, JavaType>
             SCHEMA_TYPE_TO_JAVA_OBJECT_TYPE_MAP;
 
-    /**
-     * The village method used for a given schema type.
-     * Conversions to primitive types are used where possible.
-     */
-    private static final Map<SchemaType, VillageMethod>
-            SCHEMA_TYPE_TO_VILLAGE_METHOD_MAP;
 
     /**
-     * The village method used for a given schema type.
-     * No conversions to primitive types are used.
+     * The result set getter methods for a given schema type.
      */
-    private static final Map<SchemaType, VillageMethod>
-            SCHEMA_TYPE_TO_VILLAGE_OBJECT_METHOD_MAP;
+    private static Map<SchemaType, ResultSetGetter>
+            SCHEMA_TYPE_TO_RESULT_SET_GETTER;
 
     // fill SCHEMA_TYPE_TO_INIT_VALUE_MAP
     static {
@@ -249,66 +240,34 @@ public final class TypeMap
 
     static
     {
-        Map<SchemaType, VillageMethod> schema2VillageMethod
-                = new HashMap<SchemaType, VillageMethod>();
-
-        schema2VillageMethod.put(SchemaType.CHAR, VillageMethod.STRING);
-        schema2VillageMethod.put(SchemaType.VARCHAR, VillageMethod.STRING);
-        schema2VillageMethod.put(SchemaType.LONGVARCHAR, VillageMethod.STRING);
-        schema2VillageMethod.put(SchemaType.CLOB, VillageMethod.STRING);
-        schema2VillageMethod.put(SchemaType.NUMERIC, VillageMethod.BIG_DECIMAL);
-        schema2VillageMethod.put(SchemaType.DECIMAL, VillageMethod.BIG_DECIMAL);
-        schema2VillageMethod.put(SchemaType.BIT, VillageMethod.BOOLEAN);
-        schema2VillageMethod.put(SchemaType.TINYINT, VillageMethod.BYTE);
-        schema2VillageMethod.put(SchemaType.SMALLINT, VillageMethod.SHORT);
-        schema2VillageMethod.put(SchemaType.INTEGER, VillageMethod.INT);
-        schema2VillageMethod.put(SchemaType.BIGINT, VillageMethod.LONG);
-        schema2VillageMethod.put(SchemaType.REAL, VillageMethod.FLOAT);
-        schema2VillageMethod.put(SchemaType.FLOAT, VillageMethod.DOUBLE);
-        schema2VillageMethod.put(SchemaType.DOUBLE, VillageMethod.DOUBLE);
-        schema2VillageMethod.put(SchemaType.BINARY, VillageMethod.BYTES);
-        schema2VillageMethod.put(SchemaType.VARBINARY, VillageMethod.BYTES);
-        schema2VillageMethod.put(SchemaType.LONGVARBINARY, VillageMethod.BYTES);
-        schema2VillageMethod.put(SchemaType.BLOB, VillageMethod.BYTES);
-        schema2VillageMethod.put(SchemaType.DATE, VillageMethod.UTIL_DATE);
-        schema2VillageMethod.put(SchemaType.TIME, VillageMethod.UTIL_DATE);
-        schema2VillageMethod.put(SchemaType.TIMESTAMP, VillageMethod.UTIL_DATE);
-        schema2VillageMethod.put(SchemaType.BOOLEANCHAR, VillageMethod.BOOLEAN);
-        schema2VillageMethod.put(SchemaType.BOOLEANINT, VillageMethod.BOOLEAN);
-        SCHEMA_TYPE_TO_VILLAGE_METHOD_MAP
-                = Collections.unmodifiableMap(schema2VillageMethod);
-    }
-
-    static
-    {
-        Map<SchemaType, VillageMethod> schemaToVillageMethod
-                = new HashMap<SchemaType, VillageMethod>();
+        Map<SchemaType, ResultSetGetter> schemaToResultSetGetter
+                = new HashMap<SchemaType, ResultSetGetter>();
 
-        schemaToVillageMethod.put(SchemaType.CHAR, VillageMethod.STRING);
-        schemaToVillageMethod.put(SchemaType.VARCHAR, VillageMethod.STRING);
-        schemaToVillageMethod.put(SchemaType.LONGVARCHAR, VillageMethod.STRING);
-        schemaToVillageMethod.put(SchemaType.CLOB, VillageMethod.STRING);
-        schemaToVillageMethod.put(SchemaType.NUMERIC, VillageMethod.BIG_DECIMAL);
-        schemaToVillageMethod.put(SchemaType.DECIMAL, VillageMethod.BIG_DECIMAL);
-        schemaToVillageMethod.put(SchemaType.BIT, VillageMethod.BOOLEAN_OBJECT);
-        schemaToVillageMethod.put(SchemaType.TINYINT, VillageMethod.BYTE_OBJECT);
-        schemaToVillageMethod.put(SchemaType.SMALLINT, VillageMethod.SHORT_OBJECT);
-        schemaToVillageMethod.put(SchemaType.INTEGER, VillageMethod.INTEGER_OBJECT);
-        schemaToVillageMethod.put(SchemaType.BIGINT, VillageMethod.LONG_OBJECT);
-        schemaToVillageMethod.put(SchemaType.REAL, VillageMethod.FLOAT_OBJECT);
-        schemaToVillageMethod.put(SchemaType.FLOAT, VillageMethod.DOUBLE_OBJECT);
-        schemaToVillageMethod.put(SchemaType.DOUBLE, VillageMethod.DOUBLE);
-        schemaToVillageMethod.put(SchemaType.BINARY, VillageMethod.BYTES);
-        schemaToVillageMethod.put(SchemaType.VARBINARY, VillageMethod.BYTES);
-        schemaToVillageMethod.put(SchemaType.LONGVARBINARY, VillageMethod.BYTES);
-        schemaToVillageMethod.put(SchemaType.BLOB, VillageMethod.BYTES);
-        schemaToVillageMethod.put(SchemaType.DATE, VillageMethod.UTIL_DATE);
-        schemaToVillageMethod.put(SchemaType.TIME, VillageMethod.UTIL_DATE);
-        schemaToVillageMethod.put(SchemaType.TIMESTAMP, VillageMethod.UTIL_DATE);
-        schemaToVillageMethod.put(SchemaType.BOOLEANCHAR, VillageMethod.BOOLEAN_OBJECT);
-        schemaToVillageMethod.put(SchemaType.BOOLEANINT, VillageMethod.BOOLEAN_OBJECT);
-        SCHEMA_TYPE_TO_VILLAGE_OBJECT_METHOD_MAP
-                = Collections.unmodifiableMap(schemaToVillageMethod);
+        schemaToResultSetGetter.put(SchemaType.CHAR, ResultSetGetter.STRING);
+        schemaToResultSetGetter.put(SchemaType.VARCHAR, ResultSetGetter.STRING);
+        schemaToResultSetGetter.put(SchemaType.LONGVARCHAR, ResultSetGetter.STRING);
+        schemaToResultSetGetter.put(SchemaType.CLOB, ResultSetGetter.STRING);
+        schemaToResultSetGetter.put(SchemaType.NUMERIC, ResultSetGetter.BIG_DECIMAL);
+        schemaToResultSetGetter.put(SchemaType.DECIMAL, ResultSetGetter.BIG_DECIMAL);
+        schemaToResultSetGetter.put(SchemaType.BIT, ResultSetGetter.BOOLEAN);
+        schemaToResultSetGetter.put(SchemaType.TINYINT, ResultSetGetter.BYTE);
+        schemaToResultSetGetter.put(SchemaType.SMALLINT, ResultSetGetter.SHORT);
+        schemaToResultSetGetter.put(SchemaType.INTEGER, ResultSetGetter.INT);
+        schemaToResultSetGetter.put(SchemaType.BIGINT, ResultSetGetter.LONG);
+        schemaToResultSetGetter.put(SchemaType.REAL, ResultSetGetter.FLOAT);
+        schemaToResultSetGetter.put(SchemaType.FLOAT, ResultSetGetter.DOUBLE);
+        schemaToResultSetGetter.put(SchemaType.DOUBLE, ResultSetGetter.DOUBLE);
+        schemaToResultSetGetter.put(SchemaType.BINARY, ResultSetGetter.BYTES);
+        schemaToResultSetGetter.put(SchemaType.VARBINARY, ResultSetGetter.BYTES);
+        schemaToResultSetGetter.put(SchemaType.LONGVARBINARY, ResultSetGetter.BYTES);
+        schemaToResultSetGetter.put(SchemaType.BLOB, ResultSetGetter.BYTES);
+        schemaToResultSetGetter.put(SchemaType.DATE, ResultSetGetter.DATE);
+        schemaToResultSetGetter.put(SchemaType.TIME, ResultSetGetter.TIME);
+        schemaToResultSetGetter.put(SchemaType.TIMESTAMP, ResultSetGetter.TIMESTAMP);
+        schemaToResultSetGetter.put(SchemaType.BOOLEANCHAR, ResultSetGetter.STRING);
+        schemaToResultSetGetter.put(SchemaType.BOOLEANINT, ResultSetGetter.INT);
+        SCHEMA_TYPE_TO_RESULT_SET_GETTER
+                = Collections.unmodifiableMap(schemaToResultSetGetter);
     }
 
     /**
@@ -355,27 +314,15 @@ public final class TypeMap
     }
 
     /**
-     * Return Village asX() method which corresponds to the
-     * Schema type provided.
-     *
-     * @param schemaType the Schema type
-     * @return name of the Village asX() method
-     */
-    public static VillageMethod getVillageMethod(SchemaType schemaType)
-    {
-        return SCHEMA_TYPE_TO_VILLAGE_METHOD_MAP.get(schemaType);
-    }
-
-    /**
-     * Return Village asX() method which corresponds to the
+     * Returns the result set getter method which corresponds to the
      * Schema type provided.
      *
      * @param schemaType the schema type
-     * @return name of the Village asX() method
+     * @return the result set getter method.
      */
-    public static VillageMethod getVillageObjectMethod(SchemaType schemaType)
+    public static ResultSetGetter getResultSetGetter(SchemaType schemaType)
     {
-        return SCHEMA_TYPE_TO_VILLAGE_OBJECT_METHOD_MAP.get(schemaType);
+        return SCHEMA_TYPE_TO_RESULT_SET_GETTER.get(schemaType);
     }
 
     /**

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml Wed Oct 27 22:52:15 2010
@@ -51,7 +51,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table">
+    <source xsi:type="fileSource" elements="database/all-tables/table">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -77,7 +77,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table">
+    <source xsi:type="fileSource" elements="database/all-tables/table">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -104,7 +104,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table/column/inheritance">
+    <source xsi:type="fileSource" elements="database/all-tables/table/column/inheritance">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -131,7 +131,7 @@
             acceptNotSet="true"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table"
+    <source xsi:type="fileSource" elements="database/all-tables/table"
         skipDecider="org.apache.torque.templates.skipdecider.InterfaceSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
@@ -159,7 +159,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table">
+    <source xsi:type="fileSource" elements="database/all-tables/table">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -186,7 +186,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table">
+    <source xsi:type="fileSource" elements="database/all-tables/table">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -213,7 +213,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table">
+    <source xsi:type="fileSource" elements="database/all-tables/table">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
       <exclude>id-table-schema.xml</exclude>
@@ -240,7 +240,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table"
+    <source xsi:type="fileSource" elements="database/all-tables/table"
         skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
@@ -268,7 +268,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table"
+    <source xsi:type="fileSource" elements="database/all-tables/table"
         skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
@@ -296,7 +296,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table/column/inheritance"
+    <source xsi:type="fileSource" elements="database/all-tables/table/column/inheritance"
         skipDecider="org.apache.torque.templates.skipdecider.BeanSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
@@ -380,7 +380,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table" 
+    <source xsi:type="fileSource" elements="database/all-tables/table" 
         skipDecider="org.apache.torque.templates.skipdecider.ManagerSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>
@@ -409,7 +409,7 @@
             acceptNotSet="false"/>
       </mergepoint>
     </filenameOutlet>
-    <source xsi:type="fileSource" elements="database/table"
+    <source xsi:type="fileSource" elements="database/all-tables/table"
         skipDecider="org.apache.torque.templates.skipdecider.ManagerSkipDecider">
       <transformer class="org.apache.torque.templates.transformer.om.OMTransformer"/>
       <include>*schema.xml</include>

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Wed Oct 27 22:52:15 2010
@@ -90,6 +90,8 @@ torque.om.className.baseBeanClassNamePre
 torque.om.className.baseBeanClassNameSuffix = Bean
 torque.om.className.mapBuilderClassNamePrefix =
 torque.om.className.mapBuilderClassNameSuffix = MapBuilder
+torque.om.className.recordMapperClassNamePrefix =
+torque.om.className.recordMapperClassNameSuffix = RecordMapper
 
 torque.om.package.dbObjectPackageSuffix =
 torque.om.package.baseDbObjectPackageSuffix =

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/dbObject.xml Wed Oct 27 22:52:15 2010
@@ -210,6 +210,10 @@
   <outlet name="torque.om.dbObject.base.copyMethods"
       xsi:type="velocityOutlet"
       path="dbObject/base/copyMethods.vm">
+    <mergepoint name="createObjectInstance">
+      <action xsi:type="applyAction"
+          outlet="torque.om.createDbObjectInstance"/>
+    </mergepoint>
   </outlet>
 
   <outlet name="torque.om.dbObject.base.peerGetter"

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/general.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/general.xml?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/general.xml (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/general.xml Wed Oct 27 22:52:15 2010
@@ -74,4 +74,8 @@
       path="general/setterReferencedObject.vm">
   </outlet>
   
+  <outlet name="torque.om.createDbObjectInstance"
+      xsi:type="velocityOutlet"
+      path="general/createDbObjectInstance.vm">
+  </outlet>
 </outlets>
\ No newline at end of file

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Wed Oct 27 22:52:15 2010
@@ -85,21 +85,9 @@
     <mergepoint name="correctBooleans">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.correctBooleans"/>
     </mergepoint>
-    <mergepoint name="row2Object">
-      <action xsi:type="applyAction" outlet="torque.om.peer.base.row2Object"/>
-    </mergepoint>
-    <mergepoint name="populateObject">
-      <action xsi:type="applyAction" outlet="torque.om.peer.base.populateObject"/>
-    </mergepoint>
     <mergepoint name="doSelect">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.doSelect"/>
     </mergepoint>
-    <mergepoint name="doSelectVillageRecords">
-      <action xsi:type="applyAction" outlet="torque.om.peer.base.doSelectVillageRecords"/>
-    </mergepoint>
-    <mergepoint name="populateObjects">
-      <action xsi:type="applyAction" outlet="torque.om.peer.base.populateObjects"/>
-    </mergepoint>
     <mergepoint name="getOMClass">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.getOMClass"/>
     </mergepoint>
@@ -115,6 +103,9 @@
     <mergepoint name="buildSelectCriteria">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.buildSelectCriteria"/>
     </mergepoint>
+    <mergepoint name="buildColumnValues">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.buildColumnValues"/>
+    </mergepoint>
     <mergepoint name="retrieveByPK">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.retrieveByPK"/>
     </mergepoint>
@@ -133,6 +124,9 @@
     <mergepoint name="setDbName">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.setDbName"/>
     </mergepoint>
+    <mergepoint name="recordMapper">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.recordmapper.recordMapper"/>
+    </mergepoint>
     <mergepoint name="extensions" />
   </outlet>
 
@@ -228,31 +222,11 @@
       path="peer/base/correctBooleans.vm">
   </outlet>
 
-  <outlet name="torque.om.peer.base.row2Object"
-      xsi:type="velocityOutlet"
-      path="peer/base/row2Object.vm">
-  </outlet>
-
-  <outlet name="torque.om.peer.base.populateObject"
-      xsi:type="velocityOutlet"
-      path="peer/base/populateObject.vm">
-  </outlet>
-
   <outlet name="torque.om.peer.base.doSelect"
       xsi:type="velocityOutlet"
       path="peer/base/doSelect.vm">
   </outlet>
 
-  <outlet name="torque.om.peer.base.doSelectVillageRecords"
-      xsi:type="velocityOutlet"
-      path="peer/base/doSelectVillageRecords.vm">
-  </outlet>
-
-  <outlet name="torque.om.peer.base.populateObjects"
-      xsi:type="velocityOutlet"
-      path="peer/base/populateObjects.vm">
-  </outlet>
-
   <outlet name="torque.om.peer.base.getOMClass"
       xsi:type="velocityOutlet"
       path="peer/base/getOMClass.vm">
@@ -278,6 +252,11 @@
       path="peer/base/buildSelectCriteria.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.buildColumnValues"
+      xsi:type="velocityOutlet"
+      path="peer/base/buildColumnValues.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.base.retrieveByPK"
       xsi:type="velocityOutlet"
       path="peer/base/retrieveByPK.vm">
@@ -308,4 +287,32 @@
       path="peer/base/setDbName.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.recordmapper.recordMapper"
+      xsi:type="velocityOutlet"
+      path="peer/base/recordmapper/recordMapper.vm">
+    <mergepoint name="createDbObjectInstance">
+      <action xsi:type="applyAction"
+          outlet="torque.om.createDbObjectInstance"/>
+    </mergepoint>
+    <mergepoint name="createDbObjectInstanceFromInheritance">
+      <action xsi:type="traverseAllAction"
+          element="inheritance-column"
+          outlet="torque.om.peer.base.recordmapper.createDbObjectInstanceFromInheritance"/>
+    </mergepoint>
+    <mergepoint name="dbObjectFieldGetters">
+      <action xsi:type="traverseAllAction"
+          element="column"
+          outlet="torque.om.peer.base.recordmapper.dbObjectFieldGetter"/>
+    </mergepoint>
+  </outlet>
+
+  <outlet name="torque.om.peer.base.recordmapper.dbObjectFieldGetter"
+      xsi:type="velocityOutlet"
+      path="peer/base/recordmapper/dbObjectFieldGetter.vm">
+  </outlet>
+  <outlet name="torque.om.peer.base.recordmapper.createDbObjectInstanceFromInheritance"
+      xsi:type="velocityOutlet"
+      path="peer/base/recordmapper/createDbObjectInstanceFromInheritance.vm">
+  </outlet>
+
 </outlets>
\ No newline at end of file

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/bean/objectBeanMethods.vm Wed Oct 27 22:52:15 2010
@@ -69,25 +69,25 @@
       #set ( $foreignTableElement = $foreignKeyElement.getParent() )
       #set ( $foreignTableName = $foreignTableElement.getAttribute("name") )
       #if ($foreignTableName != $name)
-        #set ( $fieldElement = $foreignKeyElement.getChild("foreign-field") )
+        #set ( $foreignFieldElement = $foreignKeyElement.getChild("foreign-field") )
         ## if the referencing table is in an external schema, 
         ## fieldElement is null. In this case,skip the following code.
-        #if ($fieldElement)
+        #if ($foreignFieldElement)
           #set ( $foreignClassName = $foreignTableElement.getAttribute("javaName") )
           #set ( $foreignBeanClassName = $foreignTableElement.getAttribute("beanClassName") )
-          #set ( $field = $fieldElement.getAttribute("field") )
-          #set ( $fieldContainedType = $fieldElement.getAttribute("fieldContainedType") )
+          #set ( $foreignField = $foreignFieldElement.getAttribute("field") )
+          #set ( $foreignFieldContainedType = $foreignFieldElement.getAttribute("fieldContainedType") )
           #set ( $beanFieldElement = $foreignKeyElement.getChild("foreign-field-in-bean") )
           #set ( $beanFieldType = $beanFieldElement.getAttribute("fieldType") )
           #set ( $beanFieldContainedType = $beanFieldElement.getAttribute("fieldContainedType") )
           #set ( $beanFieldInitializerType = $beanFieldElement.getAttribute("initializerType") )
           #set ( $beanFieldSetter = $beanFieldElement.getAttribute("setter") )
-        if ($field != null)
+        if ($foreignField != null)
         {
-            ${beanFieldType} relatedBeans = new ${beanFieldInitializerType}(${field}.size());
-            for (Iterator<$fieldContainedType> ${field}It = ${field}.iterator(); ${field}It.hasNext(); )
+            ${beanFieldType} relatedBeans = new ${beanFieldInitializerType}(${foreignField}.size());
+            for (Iterator<$foreignFieldContainedType> ${foreignField}It = ${foreignField}.iterator(); ${foreignField}It.hasNext(); )
             {
-                ${fieldContainedType} related = ${field}It.next();
+                ${foreignFieldContainedType} related = ${foreignField}It.next();
                 ${foreignBeanClassName} relatedBean = related.getBean(createdBeans);
                 relatedBeans.add(relatedBean);
             }
@@ -102,13 +102,13 @@
   #foreach ($foreignKeyElement in $foreignKeyElements)
     #set ( $foreignTableElement = $foreignKeyElement.getChild("table") )
     #set ( $foreignBeanClassName = $foreignTableElement.getAttribute("beanClassName") )
-    #set ( $fieldElement = $foreignKeyElement.getChild("local-field") )
-    #set ( $field = $fieldElement.getAttribute("field") )
+    #set ( $localFieldElement = $foreignKeyElement.getChild("local-field") )
+    #set ( $localField = $localFieldElement.getAttribute("field") )
     #set ( $beanFieldElement = $foreignKeyElement.getChild("local-field-in-bean") )
     #set ( $beanFieldSetter = $beanFieldElement.getAttribute("setter") )
-        if ($field != null)
+        if ($localField != null)
         {
-            ${foreignBeanClassName} relatedBean = ${field}.getBean(createdBeans);
+            ${foreignBeanClassName} relatedBean = ${localField}.getBean(createdBeans);
             result.${beanFieldSetter}(relatedBean);
         }
   #end
@@ -186,19 +186,15 @@
       #set ( $foreignTableElement = $foreignKeyElement.getParent() )
       #set ( $foreignTableName = $foreignTableElement.getAttribute("name") )
       #if ($foreignTableName != $name)
-        #set ( $fieldElement = $foreignKeyElement.getChild("foreign-field") )
+        #set ( $foreignFieldElement = $foreignKeyElement.getChild("foreign-field") )
         ## if the referencing table is in an external schema, 
         ## fieldElement is null. In this case,skip the following code.
-        #if ($fieldElement)
+        #if ($foreignFieldElement)
           #set ( $foreignClassName = $foreignTableElement.getAttribute("javaName") )
           #set ( $foreignBeanClassName = $foreignTableElement.getAttribute("beanClassName") )
-          #set ( $field = $fieldElement.getAttribute("field") )
-          #set ( $fieldType = $fieldElement.getAttribute("fieldType") )
-          #set ( $fieldContainedType = $fieldElement.getAttribute("fieldContainedType") )
-          #set ( $initializerType = $fieldElement.getAttribute("initializerType") )
           #set ( $beanFieldElement = $foreignKeyElement.getChild("foreign-field-in-bean") )
           #set ( $beanGetter = $beanFieldElement.getAttribute("getter") )
-          #set ( $adder = $fieldElement.getAttribute("adder") )
+          #set ( $adder = $foreignFieldElement.getAttribute("adder") )
         {
             List<$foreignBeanClassName> relatedBeans = bean.${beanGetter}();
             if (relatedBeans != null)
@@ -220,16 +216,16 @@
   #foreach ($foreignKeyElement in $foreignKeyElements)
     #set ( $foreignTableElement = $foreignKeyElement.getChild("table") )
     #set ( $foreignBeanClassName = $foreignTableElement.getAttribute("beanClassName") )
-    #set ( $fieldElement = $foreignKeyElement.getChild("local-field") )
-    #set ( $fieldType = $fieldElement.getAttribute("fieldType") )
-    #set ( $setter = $fieldElement.getAttribute("setter") )
+    #set ( $localFieldElement = $foreignKeyElement.getChild("local-field") )
+    #set ( $localFieldType = $localFieldElement.getAttribute("fieldType") )
+    #set ( $setter = $localFieldElement.getAttribute("setter") )
     #set ( $beanFieldElement = $foreignKeyElement.getChild("local-field-in-bean") )
     #set ( $beanGetter = $beanFieldElement.getAttribute("getter") )
         {
             ${foreignBeanClassName} relatedBean = bean.${beanGetter}();
             if (relatedBean != null)
             {
-                ${fieldType} relatedObject = ${fieldType}.create${fieldType}(relatedBean, createdObjects);
+                ${localFieldType} relatedObject = ${localFieldType}.create${localFieldType}(relatedBean, createdObjects);
                 result.${setter}(relatedObject);
             }
         }
@@ -244,18 +240,18 @@
   ## foreign references to this Object
   #if ($objectIsCaching)
     #foreach ($foreignKeyElement in $referencingForeignKeyElements)
-      #set ( $fieldElement = $foreignKeyElement.getChild("foreign-field") )
+      #set ( $foreignFieldElement = $foreignKeyElement.getChild("foreign-field") )
       ## if the referencing table is in an external schema, 
       ## fieldElement is null. In this case,skip the following code.
-      #if ($fieldElement)
+      #if ($foreignFieldElement)
         #set ( $foreignTableElement = $foreignKeyElement.getParent() )
         #set ( $foreignTableName = $foreignTableElement.getAttribute("name") )
         #if ($foreignTableName != $name)
           #set ( $foreignClassName = $foreignTableElement.getAttribute("javaName") )
-          #set ( $field = $fieldElement.getAttribute("field") )
-          #set ( $initializerType = $fieldElement.getAttribute("initializerType") )
-          #set ( $adder = $fieldElement.getAttribute("adder") )
-          #set ( $initializer = $fieldElement.getAttribute("initializer") )
+          #set ( $foreignField = $foreignFieldElement.getAttribute("field") )
+          #set ( $initializerType = $foreignFieldElement.getAttribute("initializerType") )
+          #set ( $adder = $foreignFieldElement.getAttribute("adder") )
+          #set ( $initializer = $foreignFieldElement.getAttribute("initializer") )
  
     /**
      * Method called to associate a $foreignClassName object to this object.
@@ -267,7 +263,7 @@
     protected void ${adder}FromBean($foreignClassName toAdd)
     {
         ${initializer}();
-        ${field}.add(toAdd);
+        ${foreignField}.add(toAdd);
     }
         #end
       #end

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/copyMethods.vm Wed Oct 27 22:52:15 2010
@@ -36,24 +36,8 @@
 #if ($complexObjectModel)
         return copy(true);
 #else
-#if ($abstract == "true")
-        $dbObjectClassName copy;
-        try
-        {
-            copy = ($dbObjectClassName) ${peerClassName}.getOMClass().newInstance();
-        }
-        catch (InstantiationException e)
-        {
-            throw new TorqueException(e);
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new TorqueException(e);
-        }
-#else
-        $dbObjectClassName copy = new ${dbObjectClassName}();
-#end
-        return copyInto(copy);
+$torqueGen.mergepoint("createObjectInstance")
+        return copyInto($field);
 #end
     }
 
@@ -82,24 +66,8 @@
      */
     public $dbObjectClassName copy(boolean deepcopy) throws TorqueException
     {
-#if ($abstract == "true")
-        $dbObjectClassName copy;
-        try
-        {
-            copy = ($dbObjectClassName) ${peerClassName}.getOMClass().newInstance();
-        }
-        catch (InstantiationException e)
-        {
-            throw new TorqueException(e);
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new TorqueException(e);
-        }
-#else
-        $dbObjectClassName copy = new ${dbObjectClassName}();
-#end
-        return copyInto(copy, deepcopy);
+$torqueGen.mergepoint("createObjectInstance")
+        return copyInto($field, deepcopy);
     }
 
     /**
@@ -114,24 +82,8 @@
      */
     public $dbObjectClassName copy(boolean deepcopy, Connection con) throws TorqueException
     {
-#if ($abstract == "true")
-        $dbObjectClassName copy;
-        try
-        {
-            copy = ($dbObjectClassName) ${peerClassName}.getOMClass().newInstance();
-        }
-        catch (InstantiationException e)
-        {
-            throw new TorqueException(e);
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new TorqueException(e);
-        }
-#else
-        $dbObjectClassName copy = new ${dbObjectClassName}();
-#end
-        return copyInto(copy, deepcopy, con);
+$torqueGen.mergepoint("createObjectInstance")
+        return copyInto($field, deepcopy, con);
     }
 #end
   
@@ -181,16 +133,16 @@
 #set ( $columnElements = $torqueGen.getChildren("column") )
 #foreach ($columnElement in $columnElements)
   #set ( $setter = $columnElement.getAttribute("setter") )
-  #set ( $field = $columnElement.getAttribute("field") )
-  #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+  #set ( $columnField = $columnElement.getAttribute("field") )
+  #set ( $columnFieldType = $columnElement.getAttribute("fieldType") )
   #set ( $defaultValue = $columnElement.getAttribute("defaultValue") )
   #if($columnElement.getAttribute("primaryKey") != "true")
-        copyObj.${setter}($field);
+        copyObj.${setter}($columnField);
   #else
     #if($columnElement.getAttribute("primitive") == "true")
         copyObj.${setter}($defaultValue);
     #else
-        copyObj.${setter}((${fieldType}) $defaultValue);
+        copyObj.${setter}((${columnFieldType}) $defaultValue);
     #end
   #end
 #end
@@ -206,26 +158,26 @@
     #if ($foreignFieldElement)
       #set ( $foreignTableElement = $foreignKeyElement.getParent())
       #set ( $foreignTableName = $foreignTableElement.getAttribute("name"))
-      #set ( $field = $foreignFieldElement.getAttribute("field"))
-      #set ( $fieldType = $foreignFieldElement.getAttribute("fieldType"))
-      #set ( $fieldContainedType = $foreignFieldElement.getAttribute("fieldContainedType"))
+      #set ( $columnField = $foreignFieldElement.getAttribute("field"))
+      #set ( $columnFieldType = $foreignFieldElement.getAttribute("fieldType"))
+      #set ( $columnFieldContainedType = $foreignFieldElement.getAttribute("fieldContainedType"))
       #set ( $getter = $foreignFieldElement.getAttribute("getter"))
       #set ( $adder = $foreignFieldElement.getAttribute("adder"))
       #if ($foreignTableName != $name)
         #if ($objectIsCaching)
           ## field can be null if the generator property
           ## torque.silentDbFetch is set to false
-            if ($field != null)
+            if ($columnField != null)
             {
-                for (int i = 0; i < ${field}.size(); i++)
+                for (int i = 0; i < ${columnField}.size(); i++)
                 {
-                    ${fieldContainedType} obj = ${field}.get(i);
+                    ${columnFieldContainedType} obj = ${columnField}.get(i);
                     copyObj.${adder}(obj.copy());
                 }
             }
             else
             {
-                copyObj.${field} = null;
+                copyObj.${columnField} = null;
             }
         #end
       #end
@@ -252,16 +204,16 @@
   #set ( $columnElements = $torqueGen.getChildren("column") )
   #foreach ($columnElement in $columnElements)
     #set ( $setter = $columnElement.getAttribute("setter") )
-    #set ( $field = $columnElement.getAttribute("field") )
-    #set ( $fieldType = $columnElement.getAttribute("fieldType") )
+    #set ( $columnField = $columnElement.getAttribute("field") )
+    #set ( $columnFieldType = $columnElement.getAttribute("fieldType") )
     #set ( $defaultValue = $columnElement.getAttribute("defaultValue") )
     #if($columnElement.getAttribute("primaryKey") != "true")
-        copyObj.${setter}($field);
+        copyObj.${setter}($columnField);
     #else
       #if($columnElement.getAttribute("primitive") == "true")
         copyObj.${setter}($defaultValue);
       #else
-        copyObj.${setter}((${fieldType}) $defaultValue);
+        copyObj.${setter}((${columnFieldType}) $defaultValue);
       #end
     #end
   #end
@@ -272,21 +224,18 @@
   #foreach ($foreignKeyElement in $foreignKeyElements)
     #set ( $foreignFieldElement = $foreignKeyElement.getChild("foreign-field"))
     ## if the referencing table is in an external schema, 
-    ## foreignFieldElement is null. In this case,skip the foolowing code.
+    ## foreignFieldElement is null. In this case,skip the following code.
     #if ($foreignFieldElement)
       #set ( $foreignTableElement = $foreignKeyElement.getParent())
       #set ( $foreignTableName = $foreignTableElement.getAttribute("name"))
-      #set ( $field = $foreignFieldElement.getAttribute("field"))
-      #set ( $fieldType = $foreignFieldElement.getAttribute("fieldType"))
-      #set ( $fieldContainedType = $foreignFieldElement.getAttribute("fieldContainedType"))
+      #set ( $columnField = $foreignFieldElement.getAttribute("field"))
+      #set ( $columnFieldContainedType = $foreignFieldElement.getAttribute("fieldContainedType"))
       #set ( $getter = $foreignFieldElement.getAttribute("getter"))
       #set ( $adder = $foreignFieldElement.getAttribute("adder"))
       #if ($foreignTableName != $name)
         #if ($objectIsCaching)
-            $getter(con);
-            for (int i = 0; i < ${field}.size(); i++)
+            for (${columnFieldContainedType} obj : $getter(con))
             {
-                ${fieldContainedType} obj = ${field}.get(i);
                 copyObj.${adder}(obj.copy());
             }
         #end

Modified: db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm?rev=1028130&r1=1028129&r2=1028130&view=diff
==============================================================================
--- db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm (original)
+++ db/torque/torque4/branches/trunk-without-village/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/dbObject/base/getByNameMethods.vm Wed Oct 27 22:52:15 2010
@@ -57,26 +57,26 @@
     public Object getByName(String name)
     {
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $javaName = ${columnElement.getAttribute("javaName")} )
   #set ( $getter = ${columnElement.getAttribute("getter")} )
         if (name.equals("$javaName"))
         {
-  #if ($fieldType == "int")
+  #if ($columnFieldType == "int")
             return new Integer(${getter}());
-  #elseif ($fieldType == "long")
+  #elseif ($columnFieldType == "long")
             return new Long(${getter}());
-  #elseif ($fieldType == "float")
+  #elseif ($columnFieldType == "float")
             return new Float(${getter}());
-  #elseif ($fieldType == "double")
+  #elseif ($columnFieldType == "double")
             return new Double(${getter}());
-  #elseif ($fieldType == "boolean")
+  #elseif ($columnFieldType == "boolean")
             return new Boolean(${getter}());
-  #elseif ($fieldType == "short")
+  #elseif ($columnFieldType == "short")
             return new Short(${getter}());
-  #elseif ($fieldType == "byte")
+  #elseif ($columnFieldType == "byte")
             return new Byte(${getter}());
-  #elseif ($fieldType == "char")
+  #elseif ($columnFieldType == "char")
             return new Character(${getter}());
   #else
             return ${getter}();
@@ -99,56 +99,56 @@
         throws TorqueException, IllegalArgumentException
     {
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $javaName = ${columnElement.getAttribute("javaName")} )
   #set ( $setter = ${columnElement.getAttribute("setter")} )
   #set ( $primitive = ${columnElement.getAttribute("primitive")} )
         if (name.equals("${javaName}"))
         {
   #if ( ${primitive} == "true" )
-    #if ($fieldType == "int")
+    #if ($columnFieldType == "int")
             if (value == null || ! (Integer.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
             }
             ${setter}(((Integer) value).intValue());
-    #elseif ($fieldType == "long")
+    #elseif ($columnFieldType == "long")
             if (value == null || ! (Long.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Long object.");
             }
             ${setter}(((Long) value).longValue());
-    #elseif ($fieldType == "float")
+    #elseif ($columnFieldType == "float")
             if (value == null || ! (Float.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Float object.");
             }
             ${setter}(((Float) value).floatValue());
-    #elseif ($fieldType == "double")
+    #elseif ($columnFieldType == "double")
             if (value == null || ! (Double.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Double object.");
             }
             ${setter}(((Double) value).doubleValue());
-    #elseif ($fieldType == "boolean")
+    #elseif ($columnFieldType == "boolean")
             if (value == null || ! (Boolean.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Boolean object.");
             }
             ${setter}(((Boolean)value).booleanValue());
-    #elseif ($fieldType == "short")
+    #elseif ($columnFieldType == "short")
             if (value == null || ! (Short.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Short object.");
             }
             ${setter}(((Short)value).shortValue());
-    #elseif ($fieldType == "byte")
+    #elseif ($columnFieldType == "byte")
             if (value == null || ! (Byte.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Byte object.");
             }
             ${setter}(((Byte) value).byteValue());
-    #elseif ($fieldType == "char")
+    #elseif ($columnFieldType == "char")
             if (value == null || ! (Character.class.isInstance(value)))
             {
                 throw new IllegalArgumentException("setByName: value parameter was null or not a Character object.");
@@ -156,13 +156,13 @@
             ${setter}(((Character) value).charValue());
     #end
   #else
-    #if ( ${fieldType} )
+    #if ( ${columnFieldType} )
             // Object fields can be null
-            if (value != null && ! ${fieldType}.class.isInstance(value))
+            if (value != null && ! ${columnFieldType}.class.isInstance(value))
             {
                 throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
             }
-            ${setter}(($fieldType) value);
+            ${setter}(($columnFieldType) value);
     #else
             // Hmm, using column type that can't be mapped to a Java object class, make this obvious.
             throw IllegalStateException("Can't determine Java Object type for column, ${javaName}!");
@@ -185,26 +185,26 @@
     public Object getByPeerName(String name)
     {
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $getter = ${columnElement.getAttribute("getter")} )
   #set ( $peerColumnName = ${columnElement.getAttribute("peerColumnName")} )
         if (name.equals(${peerName}.${peerColumnName}))
         {
-  #if ($fieldType == "int")
+  #if ($columnFieldType == "int")
             return new Integer(${getter}());
-  #elseif ($fieldType == "long")
+  #elseif ($columnFieldType == "long")
             return new Long(${getter}());
-  #elseif ($fieldType == "float")
+  #elseif ($columnFieldType == "float")
             return new Float(${getter}());
-  #elseif ($fieldType == "double")
+  #elseif ($columnFieldType == "double")
             return new Double(${getter}());
-  #elseif ($fieldType == "boolean")
+  #elseif ($columnFieldType == "boolean")
             return new Boolean(${getter}());
-  #elseif ($fieldType == "short")
+  #elseif ($columnFieldType == "short")
             return new Short(${getter}());
-  #elseif ($fieldType == "byte")
+  #elseif ($columnFieldType == "byte")
             return new Byte(${getter}());
-  #elseif ($fieldType == "char")
+  #elseif ($columnFieldType == "char")
             return new Character(${getter}());
   #else
             return ${getter}();
@@ -227,7 +227,7 @@
         throws TorqueException, IllegalArgumentException
     {
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $javaName = ${columnElement.getAttribute("javaName")} )
   #set ( $peerColumnName = ${columnElement.getAttribute("peerColumnName")} )
         if (${peerName}.${peerColumnName}.equals(name))
@@ -249,25 +249,25 @@
     {
 #set ($i = 0)
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $getter = ${columnElement.getAttribute("getter")} )
         if (pos == $i)
         {
-  #if ($fieldType == "int")
+  #if ($columnFieldType == "int")
             return new Integer(${getter}());
-  #elseif ($fieldType == "long")
+  #elseif ($columnFieldType == "long")
             return new Long(${getter}());
-  #elseif ($fieldType == "float")
+  #elseif ($columnFieldType == "float")
             return new Float(${getter}());
-  #elseif ($fieldType == "double")
+  #elseif ($columnFieldType == "double")
             return new Double(${getter}());
-  #elseif ($fieldType == "boolean")
+  #elseif ($columnFieldType == "boolean")
             return new Boolean(${getter}());
-  #elseif ($fieldType == "short")
+  #elseif ($columnFieldType == "short")
             return new Short(${getter}());
-  #elseif ($fieldType == "byte")
+  #elseif ($columnFieldType == "byte")
             return new Byte(${getter}());
-  #elseif ($fieldType == "char")
+  #elseif ($columnFieldType == "char")
             return new Character(${getter}());
   #else
             return ${getter}();
@@ -292,7 +292,7 @@
     {
 #set ($i = 0)
 #foreach ($columnElement in $columnElements)
-  #set ( $fieldType = ${columnElement.getAttribute("fieldType")} )
+  #set ( $columnFieldType = ${columnElement.getAttribute("fieldType")} )
   #set ( $javaName = ${columnElement.getAttribute("javaName")} )
   #set ( $setter = ${columnElement.getAttribute("setter")} )
         if (position == $i)



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message