db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1103171 [2/4] - in /db/torque/torque4/trunk: torque-runtime/src/main/java/org/apache/torque/util/ torque-runtime/src/test/java/org/apache/torque/sql/ torque-runtime/src/test/java/org/apache/torque/util/ torque-templates/src/main/java/org/a...
Date Sat, 14 May 2011 17:34:25 GMT
Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/sql/SqlBuilderTest.java Sat May 14 17:34:23 2011
@@ -22,8 +22,7 @@ package org.apache.torque.sql;
 import java.lang.reflect.Array;
 import java.util.List;
 
-import junit.framework.TestCase;
-
+import org.apache.torque.BaseTestCase;
 import org.apache.torque.TorqueException;
 import org.apache.torque.adapter.DB;
 import org.apache.torque.adapter.DBFactory;
@@ -36,7 +35,7 @@ import org.apache.torque.util.SqlEnum;
  * @author <a href="mailto:seade@backstagetech.com.au">Scott Eade</a>
  * @version $Id$
  */
-public class SqlBuilderTest extends TestCase
+public class SqlBuilderTest extends BaseTestCase
 {
     private DB db = null;
 
@@ -52,8 +51,9 @@ public class SqlBuilderTest extends Test
     /**
      * set up environment
      */
-    public void setUp()
+    public void setUp() throws TorqueException
     {
+        super.setUp();
         try
         {
             db = DBFactory.create("mysql");

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/CriteriaTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/CriteriaTest.java?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/CriteriaTest.java (original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/util/CriteriaTest.java Sat May 14 17:34:23 2011
@@ -33,6 +33,7 @@ import org.apache.torque.map.ColumnMap;
 import org.apache.torque.map.DatabaseMap;
 import org.apache.torque.map.TableMap;
 import org.apache.torque.sql.Query;
+import org.apache.torque.sql.SqlBuilder;
 import org.apache.torque.util.Criteria.Criterion;
 import org.apache.torque.util.Criteria.Join;
 
@@ -155,7 +156,7 @@ public class CriteriaTest extends BaseTe
                 + "AND myTable3.myColumn3=?) "
             + "OR (myTable4.myColumn4=? "
                 + "AND myTable5.myColumn5=?))";
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals(expect, result.toString());
         List<Object> preparedStatementReplacements
             = result.getPreparedStatementReplacements();
@@ -196,7 +197,7 @@ public class CriteriaTest extends BaseTe
                     + "AND myTable3.myColumn3<=?) "
                 + "OR myTable4.myColumn4>?) "
                     + "AND myTable5.myColumn5>=?)";
-        result = BasePeer.createQuery(c);
+        result = SqlBuilder.buildQuery(c);
         assertEquals(expect, result.toString());
         preparedStatementReplacements
             = result.getPreparedStatementReplacements();
@@ -235,7 +236,7 @@ public class CriteriaTest extends BaseTe
         String expect =
             "SELECT  FROM INVOICE WHERE "
             + "(INVOICE.COST>=? AND INVOICE.COST<=?)";
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
 
         assertEquals(expect, result.toString());
         assertEquals(2, result.getPreparedStatementReplacements().size());
@@ -264,7 +265,7 @@ public class CriteriaTest extends BaseTe
         c.add(criterion1.and(criterion2).and(criterion3).and(criterion4));
         c.addSelectColumn("*");
         c.setDbName("postgresql");
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
 
         String expect = "SELECT * FROM TABLE WHERE "
             + "(((UPPER(TABLE.COLUMN1)=UPPER(?)"
@@ -286,7 +287,7 @@ public class CriteriaTest extends BaseTe
     {
         c.add("TABLE.COLUMN", true);
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
 
         assertEquals(
                 "SELECT  FROM TABLE WHERE TABLE.COLUMN=?",
@@ -301,7 +302,7 @@ public class CriteriaTest extends BaseTe
         c.add("TABLE.COLUMN", true);
         c.setDbName("postgresql");
 
-        result = BasePeer.createQuery(c);
+        result = SqlBuilder.buildQuery(c);
 
         assertEquals(
                 "SELECT  FROM TABLE WHERE TABLE.COLUMN=?",
@@ -319,7 +320,7 @@ public class CriteriaTest extends BaseTe
     {
          c.addDate("TABLE.DATE_COLUMN", 2003, 0, 22);
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
 
         assertEquals(
                 "SELECT  FROM TABLE WHERE TABLE.DATE_COLUMN=?",
@@ -341,7 +342,7 @@ public class CriteriaTest extends BaseTe
         c.addDate("TABLE.DATE_COLUMN", 2003, 0, 22, Criteria.GREATER_THAN);
         c.andDate("TABLE.DATE_COLUMN", 2004, 2, 24, Criteria.LESS_THAN);
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals(
                 "SELECT  FROM TABLE WHERE "
                     + "(TABLE.DATE_COLUMN>? AND TABLE.DATE_COLUMN<?)",
@@ -366,7 +367,7 @@ public class CriteriaTest extends BaseTe
         Date date = cal.getTime();
         c.add("TABLE.DATE_COLUMN", date);
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals(
                 "SELECT  FROM TABLE WHERE "
                     + "TABLE.DATE_COLUMN=?",
@@ -386,7 +387,7 @@ public class CriteriaTest extends BaseTe
                 .add("TABLE.TIME_COLUMN", Criteria.CURRENT_TIME);
         c.addSelectColumn("COUNT(*)");
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals(
                 "SELECT COUNT(*) FROM TABLE WHERE "
                     + "TABLE.TIME_COLUMN=CURRENT_TIME "
@@ -404,7 +405,7 @@ public class CriteriaTest extends BaseTe
         c.setOffset(3).setLimit(5);
         c.addSelectColumn("COUNT(*)");
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         String expect
             = "SELECT COUNT(*) FROM TABLE WHERE TABLE.DATE_COLUMN=?"
                 + " LIMIT 5 OFFSET 3";
@@ -420,7 +421,7 @@ public class CriteriaTest extends BaseTe
         c.setOffset(3);
         c.addSelectColumn("COUNT(*)");
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         String expect
             = "SELECT COUNT(*) FROM TABLE WHERE TABLE.DATE_COLUMN=?"
                 + " LIMIT 18446744073709551615 OFFSET 3";
@@ -433,7 +434,7 @@ public class CriteriaTest extends BaseTe
         c.setLimit(5);
         c.addSelectColumn("COUNT(*)");
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         String expect
             = "SELECT COUNT(*) FROM TABLE WHERE TABLE.DATE_COLUMN=?"
                 + " LIMIT 5";
@@ -449,7 +450,7 @@ public class CriteriaTest extends BaseTe
     {
         c.add("TABLE.COLUMN", (Object) "no wildcards", Criteria.LIKE);
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals(
                 "SELECT  FROM TABLE WHERE "
                     + "TABLE.COLUMN=?",
@@ -478,7 +479,7 @@ public class CriteriaTest extends BaseTe
         Query result = null;
         try
         {
-            result = BasePeer.createQuery(c);
+            result = SqlBuilder.buildQuery(c);
         }
         catch (TorqueException e)
         {
@@ -626,7 +627,7 @@ public class CriteriaTest extends BaseTe
         c.addAscendingOrderByColumn(
                 "a.NAME");
 
-        Query result = BasePeer.createQuery(c);
+        Query result = SqlBuilder.buildQuery(c);
         assertEquals("SELECT AUTHOR.NAME, a.NAME "
                     + "FROM AUTHOR, AUTHOR a "
                     + "WHERE AUTHOR.AUTHOR_ID=a.AUTHOR_ID "

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableTransformer.java Sat May 14 17:34:23 2011
@@ -85,6 +85,9 @@ public class OMTableTransformer extends 
         super.transform(tableElement, controllerState);
 
         setManagerClassNameAttributes(tableElement, controllerState);
+        setPeerImplFieldNameAttribute(tableElement);
+        setPeerImplGetterAttribute(tableElement);
+        setPeerImplSetterAttribute(tableElement);
 
         createInheritanceColumnChildIfNecessary(tableElement);
         primaryKeyTransformer.transform(tableElement, controllerState,
@@ -379,4 +382,77 @@ public class OMTableTransformer extends 
                 JavaFieldAttributeName.FIELD_NAME,
                 fieldName);
     }
+
+    /**
+     * Sets the peerImplFieldName attribute of the table element if it is not
+     * already set. The field name can be used to contain a peer object
+     * corresponding to the table.
+     * The peerImplClassName attribute of the column must be already set
+     * when this method is called.
+     *
+     * @param tableElement the table element, not null.
+     */
+    protected void setPeerImplFieldNameAttribute(SourceElement tableElement)
+    {
+        if (tableElement.getAttribute(TableAttributeName.PEER_IMPL_FIELD_NAME)
+                != null)
+        {
+            return;
+        }
+        String peerImplClassName = (String) tableElement.getAttribute(
+                TableAttributeName.PEER_IMPL_CLASS_NAME);
+        String fieldName = StringUtils.uncapitalize(peerImplClassName);
+        fieldName = reservedJavaWordsWrapper.process(fieldName);
+        tableElement.setAttribute(
+                TableAttributeName.PEER_IMPL_FIELD_NAME,
+                fieldName);
+    }
+
+    /**
+     * Sets the peerImplGetter attribute of the table element if it is not
+     * already set.
+     * The peerImplClassName attribute of the column must be already set
+     * when this method is called.
+     *
+     * @param tableElement the table element, not null.
+     */
+    protected void setPeerImplGetterAttribute(SourceElement tableElement)
+    {
+        if (tableElement.getAttribute(TableAttributeName.PEER_IMPL_GETTER)
+                != null)
+        {
+            return;
+        }
+        String peerImplClassName = (String) tableElement.getAttribute(
+                TableAttributeName.PEER_IMPL_CLASS_NAME);
+        String getter = "get" + peerImplClassName;
+        getter = reservedJavaWordsWrapper.process(getter);
+        tableElement.setAttribute(
+                TableAttributeName.PEER_IMPL_GETTER,
+                getter);
+    }
+
+    /**
+     * Sets the peerImplSetter attribute of the table element if it is not
+     * already set.
+     * The peerImplClassName attribute of the column must be already set
+     * when this method is called.
+     *
+     * @param tableElement the table element, not null.
+     */
+    protected void setPeerImplSetterAttribute(SourceElement tableElement)
+    {
+        if (tableElement.getAttribute(TableAttributeName.PEER_IMPL_SETTER)
+                != null)
+        {
+            return;
+        }
+        String peerImplClassName = (String) tableElement.getAttribute(
+                TableAttributeName.PEER_IMPL_CLASS_NAME);
+        String setter = "set" + peerImplClassName;
+        setter = reservedJavaWordsWrapper.process(setter);
+        tableElement.setAttribute(
+                TableAttributeName.PEER_IMPL_SETTER,
+                setter);
+    }
 }

Modified: db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/TableAttributeName.java Sat May 14 17:34:23 2011
@@ -60,7 +60,27 @@ public enum TableAttributeName implement
     /**
      * The package name of the bean class.
      */
-    BEAN_PACKAGE("beanPackage");
+    BEAN_PACKAGE("beanPackage"),
+
+    /**
+     * The name of the field holding the peer implementation class.
+     */
+    PEER_IMPL_FIELD_NAME("peerImplFieldName"),
+
+    /**
+     * The name of the peer implementation class.
+     */
+    PEER_IMPL_CLASS_NAME("peerImplClassName"),
+
+    /**
+     * The name of the getter for the peer implementation class.
+     */
+    PEER_IMPL_GETTER("peerImplGetter"),
+
+    /**
+     * The name of the setter for the peer implementation class.
+     */
+    PEER_IMPL_SETTER("peerImplSetter");
 
     /** The name of the source element attribute, not null. */
     private String name;

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml Sat May 14 17:34:23 2011
@@ -167,6 +167,33 @@
     <outlet name="torque.om.peer"/>
   </output>
 
+  <output name="torque.om.peer.impl" skipIfExists="true">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="peerImplClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <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>
+    </source>
+    <outlet name="torque.om.peer.impl"/>
+  </output>
+
   <output name="torque.om.basePeer">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -194,6 +221,33 @@
     <outlet name="torque.om.basePeer"/>
   </output>
 
+  <output name="torque.om.basePeer.impl">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="basePeerImplClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <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>
+    </source>
+    <outlet name="torque.om.basePeer.impl"/>
+  </output>
+
   <output name="torque.om.mapBuilder">
     <filenameOutlet
         xsi:type="javaOutlet"
@@ -221,6 +275,60 @@
     <outlet name="torque.om.mapBuilder"/>
   </output>
 
+  <output name="torque.om.recordMapper" skipIfExists="true">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="recordMapperPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="recordMapperClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <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>
+    </source>
+    <outlet name="torque.om.recordmapper.recordMapper"/>
+  </output>
+
+  <output name="torque.om.baseRecordMapper">
+    <filenameOutlet
+        xsi:type="javaOutlet"
+        class="org.apache.torque.generator.outlet.java.JavaFilenameOutlet">
+      <mergepoint name="package">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseRecordMapperPackage"
+            acceptNotSet="false"/>
+      </mergepoint>
+      <mergepoint name="classname">
+        <action
+            xsi:type="sourceElementAttributeAction"
+            element="."
+            attribute="baseRecordMapperClassName"
+            acceptNotSet="false"/>
+      </mergepoint>
+    </filenameOutlet>
+    <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>
+    </source>
+    <outlet name="torque.om.recordmapper.base.recordMapperBase"/>
+  </output>
+
   <output name="torque.om.bean" skipIfExists="true">
     <filenameOutlet
         xsi:type="javaOutlet"

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/options.properties Sat May 14 17:34:23 2011
@@ -73,13 +73,18 @@ torque.om.complexObjectModel.foreignFiel
 # new options
 torque.om.dbObjectDefaultBaseClass = org.apache.torque.om.BaseObject
 torque.om.basePeerBaseClass = org.apache.torque.util.BasePeer
+torque.om.basePeerImplBaseClass = org.apache.torque.util.BasePeerImpl
 
 torque.om.className.baseDbObjectClassNamePrefix = Base
 torque.om.className.baseDbObjectClassNameSuffix =
 torque.om.className.peerClassNamePrefix =
 torque.om.className.peerClassNameSuffix = Peer
+torque.om.className.peerImplClassNamePrefix = 
+torque.om.className.peerImplClassNameSuffix = PeerImpl
 torque.om.className.basePeerClassNamePrefix = Base
 torque.om.className.basePeerClassNameSuffix = Peer
+torque.om.className.basePeerImplClassNamePrefix = Base
+torque.om.className.basePeerImplClassNameSuffix = PeerImpl
 torque.om.className.managerClassNamePrefix =
 torque.om.className.managerClassNameSuffix = Manager
 torque.om.className.baseManagerClassNamePrefix = Base
@@ -92,11 +97,15 @@ torque.om.className.mapBuilderClassNameP
 torque.om.className.mapBuilderClassNameSuffix = MapBuilder
 torque.om.className.recordMapperClassNamePrefix =
 torque.om.className.recordMapperClassNameSuffix = RecordMapper
+torque.om.className.baseRecordMapperClassNamePrefix = Base
+torque.om.className.baseRecordMapperClassNameSuffix = RecordMapper
 
 torque.om.package.dbObjectPackageSuffix =
 torque.om.package.baseDbObjectPackageSuffix =
 torque.om.package.peerPackageSuffix =
 torque.om.package.basePeerPackageSuffix =
+torque.om.package.recordMapperPackageSuffix =
+torque.om.package.baseRecordMapperPackageSuffix =
 torque.om.package.managerPackageSuffix = .manager
 torque.om.package.baseManagerPackageSuffix = .manager.base
 torque.om.package.beanPackageSuffix = .bean

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/peer.xml Sat May 14 17:34:23 2011
@@ -38,6 +38,200 @@
       path="peer/classJavadoc.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.impl"
+      xsi:type="velocityOutlet"
+      path="peer/impl/peerImpl.vm">
+    <mergepoint name="classJavadoc">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.classJavadoc"/>
+    </mergepoint>
+    <mergepoint name="serialVersionUid">
+      <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
+    </mergepoint>
+    <mergepoint name="extensions"/>
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.classJavadoc"
+      xsi:type="velocityOutlet"
+      path="peer/impl/classJavadoc.vm">
+  </outlet>
+
+  <outlet name="torque.om.basePeer.impl"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/basePeerImpl.vm">
+    <mergepoint name="imports">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.imports"/>
+    </mergepoint>
+    <mergepoint name="classJavadoc">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.classJavadoc"/>
+    </mergepoint>
+    <mergepoint name="log">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.log"/>
+    </mergepoint>
+    <mergepoint name="serialVersionUid">
+      <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
+    </mergepoint>
+    <mergepoint name="mapBuilderGetter">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.mapBuilderGetter"/>
+    </mergepoint>
+    <mergepoint name="resultSet2Objects">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.resultSet2Objects"/>
+    </mergepoint>
+    <mergepoint name="doInsert">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doInsert"/>
+    </mergepoint>
+    <mergepoint name="addSelectColumns">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.addSelectColumns"/>
+    </mergepoint>
+    <mergepoint name="correctBooleans">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.correctBooleans"/>
+    </mergepoint>
+    <mergepoint name="doSelect">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doSelect"/>
+    </mergepoint>
+    <mergepoint name="getOMClass">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.getOMClass"/>
+    </mergepoint>
+    <mergepoint name="doUpdate">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doUpdate"/>
+    </mergepoint>
+    <mergepoint name="doDelete">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.doDelete"/>
+    </mergepoint>
+    <mergepoint name="buildCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.buildCriteria"/>
+    </mergepoint>
+    <mergepoint name="buildSelectCriteria">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.buildSelectCriteria"/>
+    </mergepoint>
+    <mergepoint name="buildColumnValues">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.buildColumnValues"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPK">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.retrieveByPK"/>
+    </mergepoint>
+    <mergepoint name="retrieveByPKs">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.retrieveByPKs"/>
+    </mergepoint>
+    <mergepoint name="doSelectJoin">
+      <action xsi:type="traverseAllAction" element="foreign-key/foreign-field" outlet="torque.om.peer.impl.base.doSelectJoin"/>
+    </mergepoint>
+    <mergepoint name="doSelectJoinAllExcept">
+      <action xsi:type="traverseAllAction" element="foreign-key/foreign-field" outlet="torque.om.peer.impl.base.doSelectJoinAllExcept"/>
+    </mergepoint>
+    <mergepoint name="getTableMap">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.getTableMap"/>
+    </mergepoint>
+    <mergepoint name="setDbName">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.setDbName"/>
+    </mergepoint>
+    <mergepoint name="extensions" />
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.imports"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/imports.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.classJavadoc"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/classJavadoc.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.log"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/log.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.mapBuilderGetter"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/mapBuilderGetter.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.resultSet2Objects"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/resultSet2Objects.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doInsert"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doInsert.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.addSelectColumns"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/addSelectColumns.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.correctBooleans"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/correctBooleans.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doSelect"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doSelect.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.getOMClass"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/getOMClass.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doUpdate"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doUpdate.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doDelete"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doDelete.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.buildCriteria"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/buildCriteria.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.buildSelectCriteria"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/buildSelectCriteria.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.buildColumnValues"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/buildColumnValues.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.retrieveByPK"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/retrieveByPK.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.retrieveByPKs"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/retrieveByPKs.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doSelectJoin"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doSelectJoin.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.doSelectJoinAllExcept"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/doSelectJoinAllExcept.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.getTableMap"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/getTableMap.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.impl.base.setDbName"
+      xsi:type="velocityOutlet"
+      path="peer/impl/base/setDbName.vm">
+  </outlet>
+
   <outlet name="torque.om.basePeer"
       xsi:type="velocityOutlet"
       path="peer/base/basePeer.vm">
@@ -47,6 +241,9 @@
     <mergepoint name="classJavadoc">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.classJavadoc"/>
     </mergepoint>
+    <mergepoint name="log">
+      <action xsi:type="applyAction" outlet="torque.om.peer.impl.base.log"/>
+    </mergepoint>
     <mergepoint name="serialVersionUid">
       <action xsi:type="applyAction" outlet="torque.om.serialVersionUid"/>
     </mergepoint>
@@ -58,9 +255,21 @@
           element="column"
           outlet="torque.om.peer.base.columnConstant"/>
     </mergepoint>
+    <mergepoint name="peerImplField">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplField"/>
+    </mergepoint>
     <mergepoint name="staticInit">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.staticInit"/>
     </mergepoint>
+    <mergepoint name="peerImplCreator">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplCreator"/>
+    </mergepoint>
+    <mergepoint name="peerImplGetter">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplGetter"/>
+    </mergepoint>
+    <mergepoint name="peerImplSetter">
+      <action xsi:type="applyAction" outlet="torque.om.peer.base.peerImplSetter"/>
+    </mergepoint>
     <mergepoint name="mapBuilderGetter">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.mapBuilderGetter"/>
     </mergepoint>
@@ -121,12 +330,6 @@
     <mergepoint name="getTableMap">
       <action xsi:type="applyAction" outlet="torque.om.peer.base.getTableMap"/>
     </mergepoint>
-    <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>
 
@@ -140,6 +343,11 @@
       path="peer/base/classJavadoc.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.log"
+      xsi:type="velocityOutlet"
+      path="peer/base/log.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.base.tableDatabaseNameConstants"
       xsi:type="velocityOutlet"
       path="peer/base/tableDatabaseNameConstants.vm">
@@ -155,6 +363,11 @@
       path="peer/base/tableDatabaseNameConstantsInit.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.peerImplField"
+      xsi:type="velocityOutlet"
+      path="peer/base/peerImplField.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.base.staticInit"
       xsi:type="velocityOutlet"
       path="peer/base/staticInit.vm">
@@ -182,6 +395,21 @@
       path="peer/base/mapBuilderInit.vm">
   </outlet>
 
+  <outlet name="torque.om.peer.base.peerImplCreator"
+      xsi:type="velocityOutlet"
+      path="peer/base/peerImplCreator.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.base.peerImplGetter"
+      xsi:type="velocityOutlet"
+      path="peer/base/peerImplGetter.vm">
+  </outlet>
+
+  <outlet name="torque.om.peer.base.peerImplSetter"
+      xsi:type="velocityOutlet"
+      path="peer/base/peerImplSetter.vm">
+  </outlet>
+
   <outlet name="torque.om.peer.base.mapBuilderGetter"
       xsi:type="velocityOutlet"
       path="peer/base/mapBuilderGetter.vm">
@@ -282,37 +510,4 @@
       path="peer/base/getTableMap.vm">
   </outlet>
 
-  <outlet name="torque.om.peer.base.setDbName"
-      xsi:type="velocityOutlet"
-      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

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/recordMapper.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/recordMapper.xml?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/recordMapper.xml (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/outlets/recordMapper.xml Sat May 14 17:34:23 2011
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<outlets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://db.apache.org/torque/4.0/generator/configuration http://db.apache.org/torque/4.0/generator/configuration.xsd"
+    xmlns="http://db.apache.org/torque/4.0/generator/configuration">
+
+  <outlet name="torque.om.recordmapper.recordMapper"
+      xsi:type="velocityOutlet"
+      path="recordmapper/recordMapper.vm">
+  </outlet>
+
+  <outlet name="torque.om.recordmapper.base.recordMapperBase"
+      xsi:type="velocityOutlet"
+      path="recordmapper/base/recordMapperBase.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.recordmapper.basecreateDbObjectInstanceFromInheritance"/>
+    </mergepoint>
+    <mergepoint name="dbObjectFieldGetters">
+      <action xsi:type="traverseAllAction"
+          element="column"
+          outlet="torque.om.recordmapper.base.dbObjectFieldGetter"/>
+    </mergepoint>
+  </outlet>
+
+  <outlet name="torque.om.recordmapper.base.dbObjectFieldGetter"
+      xsi:type="velocityOutlet"
+      path="recordmapper/base/dbObjectFieldGetter.vm">
+  </outlet>
+
+  <outlet name="torque.om.recordmapper.basecreateDbObjectInstanceFromInheritance"
+      xsi:type="velocityOutlet"
+      path="recordmapper/base/createDbObjectInstanceFromInheritance.vm">
+  </outlet>
+</outlets>
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/addSelectColumns.vm Sat May 14 17:34:23 2011
@@ -37,8 +37,5 @@
     public static void addSelectColumns(Criteria criteria)
             throws TorqueException
     {
-#foreach ($columnElement in $torqueGen.getChildren("column"))
-  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName"))
-        criteria.addSelectColumn(${peerClassName}.$peerColumnName);
-#end
+        ${peerImplGetter}().addSelectColumns(criteria);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/basePeer.vm Sat May 14 17:34:23 2011
@@ -33,22 +33,22 @@ $torqueGen.mergepoint("imports")
 
 $torqueGen.mergepoint("classJavadoc")
 public abstract class $basePeerClassName
+#if ( ${basePeerBaseClass} && (${basePeerBaseClass} != "") )
     extends ${basePeerBaseClass}
+#end
 {
+$torqueGen.mergepoint("log")
 $torqueGen.mergepoint("serialVersionUid")
-
 $torqueGen.mergepoint("tableDatabaseNameConstants")
-
 $torqueGen.mergepoint("columnConstants")
-
-$torqueGen.mergepoint("staticInit")
-
-$torqueGen.mergepoint("mapBuilderGetter")
-
 $torqueGen.mergepoint("numColumnConstant")
-
 $torqueGen.mergepoint("dbObjectClassConstants")
-
+$torqueGen.mergepoint("peerImplField")
+$torqueGen.mergepoint("staticInit")
+$torqueGen.mergepoint("peerImplCreator")
+$torqueGen.mergepoint("peerImplGetter")
+$torqueGen.mergepoint("peerImplSetter")
+$torqueGen.mergepoint("mapBuilderGetter")
 $torqueGen.mergepoint("classMethods")
 $torqueGen.mergepoint("resultSet2Objects")
 $torqueGen.mergepoint("addSelectColumns")

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildColumnValues.vm Sat May 14 17:34:23 2011
@@ -33,127 +33,9 @@
      * @throws TorqueException if the table map cannot be retrieved
      *         (should not happen).
      */
-    public static ColumnValues buildColumnValues($dbObjectClassName $field)
+    public static ColumnValues buildColumnValues(${dbObjectClassName} ${field})
             throws TorqueException
     {
-        ColumnValues columnValues = new ColumnValues(getTableMap());
-#foreach ($columnElement in $torqueGen.getChildren("column"))
-  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-  #set ( $getter = $columnElement.getAttribute("getter") )
-  #set ( $primaryKey = ($columnElement.getAttribute("primaryKey") == "true") )
-  #set ( $columnType = $columnElement.getAttribute("type") )
-  #set ( $columnSchemaType = $columnElement.getAttribute("schemaType") )
-  #set ( $columnFieldName = $columnElement.getAttribute("field") )
-  #set ( $columnFieldType = $columnElement.getAttribute("fieldType") )
-  #set ( $javaType = $columnElement.getAttribute("javaType") )
-  #if ($primaryKey && !$idMethod.equals("none"))
-    #if ("boolean" == $columnFieldType)
-        if (!${field}.isNew())
-    #elseif ("primitive" == $javaType)
-        if (!${field}.isNew() || ${field}.$getter() != 0)
-    #else
-        if (!${field}.isNew() || ${field}.$getter() != null)
-    #end
-        {
-    #if ($columnType == "DATE" && $columnFieldType == "java.util.Date")
-            java.util.Date $columnFieldName = ${field}.${getter}();
-            if ($columnFieldName != null)
-            {
-                $columnFieldName = new java.sql.Date(${columnFieldName}.getTime());
-            }
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue($columnFieldName, Types.DATE));
-    #elseif ($columnType == "TIME" && $columnFieldType == "java.util.Date")
-            java.util.Date $columnFieldName = ${field}.${getter}();
-            if ($columnFieldName != null)
-            {
-                $columnFieldName = new java.sql.Time(${columnFieldName}.getTime());
-            }
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue($columnFieldName, Types.TIME));
-    #elseif ($columnType == "TIMESTAMP" && $columnFieldType == "java.util.Date")
-            java.util.Date $columnFieldName = ${field}.${getter}();
-            if ($columnFieldName != null)
-            {
-                $columnFieldName = new java.sql.Timestamp(${columnFieldName}.getTime());
-            }
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue($columnFieldName, Types.TIMESTAMP));
-    #elseif ($columnType == "BOOLEANCHAR" && $columnFieldType.equalsIgnoreCase("boolean"))
-            String $columnFieldName = Boolean.TRUE.equals(${field}.${getter}())
-                                        ? "Y"
-                                        : "N";
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue($columnFieldName, Types.CHAR));
-    #elseif ($columnType == "BOOLEANINT" && $columnFieldType.equalsIgnoreCase("boolean"))
-            Integer $columnFieldName = Boolean.TRUE.equals(${field}.${getter}())
-                                        ? new Integer(1)
-                                        : new Integer(0);
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue($columnFieldName, Types.INTEGER));
-    #else
-            columnValues.put(
-                    ${peerClassName}.$peerColumnName,
-                    new JdbcTypedValue(
-                        ${field}.${getter}(),
-                        ${columnSchemaType.getJdbcType()}));
-    #end
-        }
-  #else
-    #if ($columnType == "DATE" && $columnFieldType == "java.util.Date")
-        java.util.Date $columnFieldName = ${field}.${getter}();
-        if ($columnFieldName != null)
-        {
-            $columnFieldName = new java.sql.Date(${columnFieldName}.getTime());
-        }
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue($columnFieldName, Types.DATE));
-    #elseif ($columnType == "TIME" && $columnFieldType == "java.util.Date")
-        java.util.Date $columnFieldName = ${field}.${getter}();
-        if ($columnFieldName != null)
-        {
-            $columnFieldName = new java.sql.Time(${columnFieldName}.getTime());
-        }
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue($columnFieldName, Types.TIME));
-    #elseif ($columnType == "TIMESTAMP" && $columnFieldType == "java.util.Date")
-        java.util.Date $columnFieldName = ${field}.${getter}();
-        if ($columnFieldName != null)
-        {
-            $columnFieldName = new java.sql.Timestamp(${columnFieldName}.getTime());
-        }
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue($columnFieldName, Types.TIMESTAMP));
-    #elseif ($columnType == "BOOLEANCHAR" && $columnFieldType.equalsIgnoreCase("boolean"))
-        String $columnFieldName = Boolean.TRUE.equals(${field}.${getter}())
-                                    ? "Y"
-                                    : "N";
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue($columnFieldName, Types.CHAR));
-    #elseif ($columnType == "BOOLEANINT" && $columnFieldType.equalsIgnoreCase("boolean"))
-        Integer $columnFieldName = Boolean.TRUE.equals(${field}.${getter}())
-                                    ? new Integer(1)
-                                    : new Integer(0);
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue($columnFieldName, Types.INTEGER));
-    #else
-        columnValues.put(
-                ${peerClassName}.$peerColumnName,
-                new JdbcTypedValue(
-                    ${field}.${getter}(),
-                    ${columnSchemaType.getJdbcType()}));
-    #end
-  #end
-#end
-        return columnValues;
+        
+        return ${peerImplGetter}().buildColumnValues(${field});
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildCriteria.vm Sat May 14 17:34:23 2011
@@ -35,23 +35,8 @@
      */
     public static Criteria buildCriteria(ObjectKey pk)
     {
-        Criteria criteria = new Criteria();
-#set ( $primaryKeyColumnElements = $torqueGen.getChild("primary-keys").getChildren("column") )
-#if ($primaryKeyColumnElements.size() == 1)
-  #set ( $primaryKeyColumnElement = $primaryKeyColumnElements.get(0) )
-  #set ( $peerColumnName = $primaryKeyColumnElement.getAttribute("peerColumnName") )
-        criteria.add(${peerClassName}.$peerColumnName, pk);
-#else
-        SimpleKey[] keys = (SimpleKey[])pk.getValue();
-  #set ( $i = 0 )
-  #foreach ($primaryKeyColumnElement in $primaryKeyColumnElements)
-    #set ( $peerColumnName = $primaryKeyColumnElement.getAttribute("peerColumnName") )
-        criteria.add(${peerClassName}.$peerColumnName, keys[$i]);
-    #set ( $i = $i + 1 )
-  #end
-#end
-        return criteria;
-     }
+        return ${peerImplGetter}().buildCriteria(pk);
+    }
 
     /** 
      * Build a Criteria object from the data object for this peer.
@@ -64,19 +49,5 @@
      */
     public static Criteria buildCriteria($dbObjectClassName obj)
     {
-        Criteria criteria = new Criteria(DATABASE_NAME);
-#foreach ($columnElement in $torqueGen.getChildren("column"))
-  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-  #set ( $getter = $columnElement.getAttribute("getter") )
-  #set ( $primaryKey = ($columnElement.getAttribute("primaryKey") == "true") )
-  #if ($primaryKey && !$idMethod.equals("none"))
-        if (!obj.isNew())
-        {
-            criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
-        }
-  #else
-        criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
-  #end
-  #end
-        return criteria;
+        return ${peerImplGetter}().buildCriteria(obj);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/buildSelectCriteria.vm Sat May 14 17:34:23 2011
@@ -39,22 +39,5 @@
      */
     public static Criteria buildSelectCriteria($dbObjectClassName obj)
     {
-        Criteria criteria = new Criteria(DATABASE_NAME);
-#foreach ($columnElement in $torqueGen.getChildren("column"))
-  #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") ) 
-  #set ( $columnFieldType = $columnElement.getAttribute("fieldType") ) 
-  #set ( $getter = $columnElement.getAttribute("getter") ) 
-  #set ( $primaryKey = ($columnElement.getAttribute("primaryKey") == "true") )
-  #if ( $columnFieldType != "byte[]" )
-    #if ($primaryKey && !$idMethod.equals("none"))
-        if (!obj.isNew())
-        {
-            criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
-        }
-    #else
-        criteria.add(${peerClassName}.$peerColumnName, obj.${getter}());
-    #end
-  #end
-#end
-        return criteria;
+        return ${peerImplGetter}().buildSelectCriteria(obj);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/correctBooleans.vm Sat May 14 17:34:23 2011
@@ -31,12 +31,15 @@
      * changes the boolean values in the criteria to the appropriate type,
      * whenever a booleanchar or booleanint column is involved.
      * This enables the user to create criteria using Boolean values
-     * for booleanchar or booleanint columns
-     * @param criteria the criteria in which the boolean values should be corrected
+     * for booleanchar or booleanint columns.
+     *
+     * @param criteria the criteria in which the boolean values
+     *        should be corrected.
+     *
      * @throws TorqueException if the database map for the criteria cannot be 
                obtained.
      */
     public static void correctBooleans(Criteria criteria) throws TorqueException
     {
-        ${peerClassName}.correctBooleans(criteria, getTableMap());
+        ${peerImplGetter}().correctBooleans(criteria);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doDelete.vm Sat May 14 17:34:23 2011
@@ -36,23 +36,7 @@
      */
      public static void doDelete(Criteria criteria) throws TorqueException
      {
-        Connection connection = null;
-        try
-        {
-            connection = Transaction.beginOptional(
-                    DATABASE_NAME,
-                    true);
-            ${peerClassName}.doDelete(criteria, connection);
-            Transaction.commit(connection);
-            connection = null;
-        }
-        finally
-        {
-            if (connection != null)
-            {
-                Transaction.safeRollback(connection);
-            }
-        }
+        ${peerImplGetter}().doDelete(criteria);
      }
 
     /**
@@ -68,23 +52,18 @@
      public static void doDelete(Criteria criteria, Connection con)
         throws TorqueException
      {
-        ${peerClassName}.correctBooleans(criteria);
-
-        setDbName(criteria);
-
-        BasePeer.doDelete(criteria, TABLE_NAME, con);
+        ${peerImplGetter}().doDelete(criteria, con);
      }
 
     /**
+     * Method to delete.
      * @param obj the data object to delete in the database.
      * @throws TorqueException Any exceptions caught during processing will be
      *         rethrown wrapped into a TorqueException.
      */
     public static void doDelete($dbObjectClassName obj) throws TorqueException
     {
-        ## TODO use buildSelectCriteria if no pk is present
-        ${peerClassName}.doDelete(
-            ${peerClassName}.buildCriteria(obj.getPrimaryKey()));
+        ${peerImplGetter}().doDelete(obj);
     }
 
     /**
@@ -101,8 +80,7 @@
         throws TorqueException
     {
         ## TODO use buildSelectCriteria if no pk is present
-        ${peerClassName}.doDelete(
-            ${peerClassName}.buildCriteria(obj.getPrimaryKey()), con);
+        ${peerImplGetter}().doDelete(obj, con);
     }
 
     /**
@@ -114,7 +92,7 @@
      */
     public static void doDelete(ObjectKey pk) throws TorqueException
     {
-        ${peerClassName}.doDelete(pk, (Connection) null);
+        ${peerImplGetter}().doDelete(pk, (Connection) null);
     }
 
     /**
@@ -130,5 +108,5 @@
     public static void doDelete(ObjectKey pk, Connection con)
         throws TorqueException
     {
-        ${peerClassName}.doDelete(${peerClassName}.buildCriteria(pk), con);
+        ${peerImplGetter}().doDelete(pk, con);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doInsert.vm Sat May 14 17:34:23 2011
@@ -35,14 +35,7 @@
      */
     public static void doInsert($dbObjectClassName obj) throws TorqueException
     {
-  #if ($idMethod.equals("none") || $torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        ${peerClassName}.doInsert(${peerClassName}.buildColumnValues(obj));
-  #else
-        obj.setPrimaryKey(${peerClassName}.doInsert(
-                ${peerClassName}.buildColumnValues(obj)));
-  #end
-        obj.setNew(false);
-        obj.setModified(false);
+        ${peerImplGetter}().doInsert(obj);
     }
 
     /**
@@ -58,16 +51,5 @@
     public static void doInsert($dbObjectClassName obj, Connection con)
         throws TorqueException
     {
-  #if ($idMethod.equals("none") || $torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        ${peerClassName}.doInsert(${peerClassName}.buildColumnValues(obj), con);
-  #else
-        ObjectKey primaryKey = ${peerClassName}.doInsert(
-                ${peerClassName}.buildColumnValues(obj), con);
-        if (primaryKey != null)
-        {
-            obj.setPrimaryKey(primaryKey);
-        }
-  #end
-        obj.setNew(false);
-        obj.setModified(false);
+        ${peerImplGetter}().doInsert(obj, con);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelect.vm Sat May 14 17:34:23 2011
@@ -38,16 +38,7 @@
     public static List<${dbObjectClassName}> doSelect(Criteria criteria)
             throws TorqueException
     {
-        if (criteria.getSelectColumns().size() == 0)
-        {
-            ${peerClassName}.addSelectColumns(criteria);
-        }
-        setDbName(criteria);
-
-        return ${peerClassName}.doSelect(
-            criteria, 
-            new $recordMapperClass(),
-            getTableMap());
+        return ${peerImplGetter}().doSelect(criteria);
     }
 
     /**
@@ -65,17 +56,7 @@
                 Connection connection)
             throws TorqueException
     {
-        if (criteria.getSelectColumns().size() == 0)
-        {
-            ${peerClassName}.addSelectColumns(criteria);
-        }
-        setDbName(criteria);
-
-        return ${peerClassName}.doSelect(
-                criteria,
-                new $recordMapperClass(),
-                getTableMap(),
-                connection);
+        return ${peerImplGetter}().doSelect(criteria, connection);
     }
 
     /**
@@ -88,6 +69,5 @@
     public static List<${dbObjectClassName}> doSelect($dbObjectClassName obj)
             throws TorqueException
     {
-        return ${peerClassName}.doSelect(
-            ${peerClassName}.buildSelectCriteria(obj));
+        return ${peerImplGetter}().doSelect(obj);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoin.vm Sat May 14 17:34:23 2011
@@ -31,17 +31,7 @@
 #set ( $joinedTableElement = $foreignKeyElement.getChild("table") )
 #set ( $dbObjectClassName = $tableElement.getAttribute("dbObjectClassName") )
 #set ( $joinedDbObjectClassName = $joinedTableElement.getAttribute("dbObjectClassName") )
-#set ( $joinedDbObjectPackage = $joinedTableElement.getAttribute("dbObjectPackage") )
-#set ( $joinedDbObject = "${joinedDbObjectPackage}.$joinedDbObjectClassName" )
-#set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
-#set ( $recordMapperClass = $tableElement.getAttribute("recordMapperClass") )
-#set ( $joinedPeerClassName = $joinedTableElement.getAttribute("peerClassName") )
-#set ( $joinedPeerMapperName = $joinedTableElement.getAttribute("recordMapperClass") )
-#set ( $joinedPeerPackage = $joinedTableElement.getAttribute("peerPackage") )
-#set ( $joinedPeer = "${joinedPeerPackage}.$joinedPeerClassName" )
-#set ( $referenceElements = $foreignKeyElement.getChildren("reference") )
-#set ( $localFieldElement = $foreignKeyElement.getChild("local-field"))
-#set ( $getterForJoinedDbObject = $localFieldElement.getAttribute("getter"))
+#set ( $peerImplGetter = $tableElement.getAttribute("peerImplGetter") )
     /**
      * Selects a collection of dbObjectClassName objects pre-filled with their
      * $joinedDbObjectClassName objects.
@@ -52,25 +42,7 @@
     public static List<${dbObjectClassName}> ${peerJoinSelectMethod}(Criteria criteria)
         throws TorqueException
     {
-        Connection connection = null;
-        try
-        {
-            connection = Transaction.beginOptional(
-                    DATABASE_NAME,
-                    true);
-            List<${dbObjectClassName}> result
-                    = $peerClassName.${peerJoinSelectMethod}(criteria, connection);
-            Transaction.commit(connection);
-            connection = null;
-            return result;
-        }
-        finally
-        {
-            if (connection != null)
-            {
-                Transaction.safeRollback(connection);
-            }
-        }
+        return ${peerImplGetter}().${peerJoinSelectMethod}(criteria);
     }
 
     /**
@@ -84,55 +56,5 @@
             Criteria criteria, Connection conn)
         throws TorqueException
     {
-        setDbName(criteria);
-
-        ${peerClassName}.addSelectColumns(criteria);
-        ${joinedPeer}.addSelectColumns(criteria);
-
-        CompositeMapper compositeMapper = new CompositeMapper();
-        compositeMapper.addMapper(new ${peerClassName}.${recordMapperClass}(), 0);
-        compositeMapper.addMapper(new ${joinedPeer}.$joinedPeerMapperName(), numColumns);
-  #foreach ($referenceElement in $referenceElements)
-    #set ( $joinedColumnElement = $referenceElement.getChild("foreign-column").getChild("column") )
-    #set ( $joinedPeerColumnName = $joinedColumnElement.getAttribute("peerColumnName") )
-    #set ( $columnElement = $referenceElement.getChild("local-column").getChild("column") )
-    #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-        criteria.addJoin($peerClassName.$peerColumnName,
-            $joinedPeer.$joinedPeerColumnName);
-  #end
-
-        correctBooleans(criteria);
-
-        List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>();
-        List<List<Object>> rawResult = ${peerClassName}.doSelect(
-                criteria, compositeMapper, ${peerClassName}.getTableMap(), conn);
-        for (List<Object> rawResultRow : rawResult)
-        {
-            $dbObjectClassName obj1 = ($dbObjectClassName) rawResultRow.get(0);
-            $joinedDbObjectClassName obj2 = (${joinedDbObjectClassName}) rawResultRow.get(1);
-
-            boolean newObject = true;
-            for (int j = 0; j < result.size(); j++)
-            {
-                $dbObjectClassName temp_obj1 = result.get(j);
-                $joinedDbObject temp_obj2 = temp_obj1.${getterForJoinedDbObject}();
-                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
-                {
-                    newObject = false;
-  #if ($objectIsCaching)
-                    temp_obj2.${adder}(obj1);
-  #end
-                    break;
-                }
-            }
-  #if ($objectIsCaching)
-            if (newObject)
-            {
-                obj2.${initializer}();
-                obj2.${adder}(obj1);
-            }
-  #end
-            result.add(obj1);
-        }
-        return result;
+        return ${peerImplGetter}().${peerJoinSelectMethod}(criteria, conn);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doSelectJoinAllExcept.vm Sat May 14 17:34:23 2011
@@ -30,15 +30,9 @@
 #set ( $tableElement = $foreignKeyElement.getParent() )
 #set ( $foreignKeyElements = $tableElement.getChildren("foreign-key"))
 #if ($foreignKeyElements.size() > 2)
-  #set ( $tableName = $tableElement.getAttribute("name") )
-  #set ( $excludeTableElement = $foreignKeyElement.getChild("table") )
   #set ( $peerClassName = $tableElement.getAttribute("peerClassName") )
-  #set ( $tableField = $tableElement.getAttribute("field") )
-  #set ( $peerPackage = $tableElement.getAttribute("peerPackage") )
-  #set ( $recordMapperClass = $tableElement.getAttribute("recordMapperClass") )
+  #set ( $peerImplGetter = $tableElement.getAttribute("peerImplGetter") )
   #set ( $dbObjectClassName = $tableElement.getAttribute("dbObjectClassName") )
-  #set ( $dbObjectPackage = $tableElement.getAttribute("dbObjectPackage") )
-  #set ( $dbObject = "${dbObjectPackage}.$dbObjectClassName" )
     /**
      * selects a collection of $dbObjectClassName objects pre-filled with
      * all related objects.
@@ -53,25 +47,7 @@
     protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria)
         throws TorqueException
     {
-        Connection connection = null;
-        try
-        {
-            connection = Transaction.beginOptional(
-                    DATABASE_NAME,
-                    true);
-            List<${dbObjectClassName}> result
-                    = $peerClassName.${peerJoinAllExceptSelectMethod}(criteria, connection);
-            Transaction.commit(connection);
-            connection = null;
-            return result;
-        }
-        finally
-        {
-            if (connection != null)
-            {
-                Transaction.safeRollback(connection);
-            }
-        }
+        return ${peerImplGetter}().${peerJoinAllExceptSelectMethod}(criteria);
     }
 
     /**
@@ -88,98 +64,6 @@
     protected static List<${dbObjectClassName}> ${peerJoinAllExceptSelectMethod}(Criteria criteria, Connection conn)
         throws TorqueException
     {
-        setDbName(criteria);
-
-        CompositeMapper compositeMapper = new CompositeMapper();
-        compositeMapper.addMapper(new ${peerClassName}.${recordMapperClass}(), 0);
-        ${peerClassName}.addSelectColumns(criteria);
-        int offset = numColumns;
-  #foreach ($joinedForeignKeyElement in $foreignKeyElements)
-    #if ($joinedForeignKeyElement != $foreignKeyElement)
-      #set ( $joinedTableElement = $joinedForeignKeyElement.getChild("table"))
-      #set ( $joinedTableName = $joinedTableElement.getAttribute("name"))
-      ## want to cover this case, but the code is not there yet.
-      #if ( $joinedTableName != $tableName )
-        #set ( $joinedPeerClassName = $joinedTableElement.getAttribute("peerClassName") )
-        #set ( $joinedPeerPackage = $joinedTableElement.getAttribute("peerPackage") )
-        #set ( $joinedPeer = "${joinedPeerPackage}.${joinedPeerClassName}" )
-        #set ( $joinedPeerMapperName = $joinedTableElement.getAttribute("recordMapperClass") )
-        #set ( $referenceElements = $joinedForeignKeyElement.getChildren("reference") )
- 
-        ${joinedPeer}.addSelectColumns(criteria);
-        #foreach ($referenceElement in $referenceElements)
-          #set ( $columnElement = $referenceElement.getChild("local-column").getChild("column"))
-          #set ( $joinedColumnElement = $referenceElement.getChild("foreign-column").getChild("column"))
-          #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-          #set ( $joinedPeerColumnName = $joinedColumnElement.getAttribute("peerColumnName") )
-        criteria.addJoin(${peerClassName}.$peerColumnName, ${joinedPeer}.$joinedPeerColumnName);
-        #end
-        compositeMapper.addMapper(new ${joinedPeer}.$joinedPeerMapperName(), offset);
-        offset = offset + ${joinedPeer}.numColumns;
-      #end
-    #end
-  #end
-
-        correctBooleans(criteria);
-
-        List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>();
-        List<List<Object>> rawResult = ${peerClassName}.doSelect(
-                criteria, compositeMapper, ${peerClassName}.getTableMap(), conn);
-        for (List<Object> rawResultRow : rawResult)
-        {
-            $dbObjectClassName $tableField = ($dbObjectClassName) rawResultRow.get(0);
-  #set ( $index = 0 )
-  #foreach ($joinedForeignKeyElement in $foreignKeyElements)
-    #if ($joinedForeignKeyElement != $foreignKeyElement)
-      #set ( $joinedTableElement = $joinedForeignKeyElement.getChild("table"))
-      #set ( $joinedTableName = $joinedTableElement.getAttribute("name"))
-      ## want to cover this case, but the code is not there yet.
-      #if ( $joinedTableName != $tableName )
-        #set ( $joinedPeerClassName = $joinedTableElement.getAttribute("peerClassName") )
-        #set ( $joinedPeerPackage = $joinedTableElement.getAttribute("peerPackage") )
-        #set ( $joinedPeer = "${joinedPeerPackage}.${joinedPeerClassName}" )
-        #set ( $joinedDbObjectClassName = $joinedTableElement.getAttribute("dbObjectClassName") )
-        #set ( $joinedDbObjectPackage = $joinedTableElement.getAttribute("dbObjectPackage") )
-        #set ( $joinedDbObject = "${joinedDbObjectPackage}.${joinedDbObjectClassName}" )
-        #set ( $foreignField = $joinedForeignKeyElement.getChild("foreign-field") )
-        #set ( $adderInJoinedDbObject = $foreignField.getAttribute("adder") )
-        #set ( $initializerInJoinedDbObject = $foreignField.getAttribute("initializer") )
-        #set ( $localField = $joinedForeignKeyElement.getChild("local-field") )
-        #set ( $getter = $localField.getAttribute("getter") )
-        #set ( $index = $index + 1 )
-
-            $joinedDbObject obj$index = (${joinedDbObject}) rawResultRow.get($index);
-         #if ($index == 1)
-           #set ( $boolean = "boolean " )
-         #else
-           #set ( $boolean = "")
-         #end
-            ${boolean}newObject = true;
-            for (int j = 0; j < result.size(); j++)
-            {
-                $dbObject temp_${tableField} = result.get(j);
-                $joinedDbObject temp_obj$index = temp_${tableField}.${getter}();
-                if (temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey()))
-                {
-                    newObject = false;
-                #if ($objectIsCaching)
-                    temp_obj${index}.${adderInJoinedDbObject}($tableField);
-                #end
-                    break;
-                }
-            }
-        #if ($objectIsCaching)
-            if (newObject)
-            {
-                obj${index}.${initializerInJoinedDbObject}();
-                obj${index}.${adderInJoinedDbObject}($tableField);
-            }
-        #end
-      #end
-    #end
-  #end
-            result.add($tableField);
-        }
-        return result;
+        return ${peerImplGetter}().${peerJoinAllExceptSelectMethod}(criteria, conn);
     }
 #end

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/doUpdate.vm Sat May 14 17:34:23 2011
@@ -37,24 +37,7 @@
      */
     public static int doUpdate(ColumnValues columnValues) throws TorqueException
     {
-        Connection connection = null;
-        try
-        {
-            connection = Transaction.beginOptional(
-                    DATABASE_NAME,
-                    true);
-            int result = ${peerClassName}.doUpdate(columnValues, connection);
-            Transaction.commit(connection);
-            connection = null;
-            return result;
-        }
-        finally
-        {
-            if (connection != null)
-            {
-                Transaction.safeRollback(connection);
-            }
-        }
+        return ${peerImplGetter}().doUpdate(columnValues);
     }
 
     /**
@@ -74,20 +57,7 @@
     public static int doUpdate(ColumnValues columnValues, Connection con)
         throws TorqueException
     {
-        Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
-        ${peerClassName}.correctBooleans(columnValues);
-
-#foreach ($columnElement in $torqueGen.getChildren("column"))
-
-  #if($columnElement.getAttribute("primaryKey") == "true")
-    #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") )
-    
-        selectCriteria.put(
-                ${peerClassName}.$peerColumnName,
-                columnValues.remove(${peerClassName}.$peerColumnName).getValue());
-  #end
-#end
-        return BasePeer.doUpdate(selectCriteria, columnValues, con);
+        return ${peerImplGetter}().doUpdate(columnValues, con);
     }
 
     /**
@@ -103,15 +73,7 @@
      */
     public static int doUpdate($dbObjectClassName obj) throws TorqueException
     {
-#if ($torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        throw new TorqueException(
-                "doUpdate does not work for objects without primary key");
-#else
-        ColumnValues columnValues = ${peerClassName}.buildColumnValues(obj);
-        int result = ${peerClassName}.doUpdate(columnValues);
-        obj.setModified(false);
-        return result;
-#end
+        return ${peerImplGetter}().doUpdate(obj);
     }
 
     /**
@@ -129,13 +91,5 @@
     public static int doUpdate($dbObjectClassName obj, Connection con)
         throws TorqueException
     {
-  #if ($torqueGen.getChild("primary-keys").getChildren("column").isEmpty())
-        throw new TorqueException(
-                "doUpdate does not work for objects without primary key");
-  #else
-        ColumnValues columnValues = ${peerClassName}.buildColumnValues(obj);
-        int result = ${peerClassName}.doUpdate(columnValues, con);
-        obj.setModified(false);
-        return result;
-  #end
+        return ${peerImplGetter}().doUpdate(obj, con);
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getOMClass.vm Sat May 14 17:34:23 2011
@@ -38,14 +38,6 @@
     public static Class<?> getOMClass()
         throws TorqueException
     {
-#if ($abstract == "true")
-        String error = "You must implement the getOMClass method in your";
-               error += " Peer object in order for things to work properly.";
-               error += " This method should return the proper Class that";
-               error += " represents the Peer's Business Object.";
-        throw new TorqueException (error);
-#else
-        return ${peerClassName}.CLASS_DEFAULT;
-#end
+        return ${peerImplGetter}().getOMClass();
     }
 

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/getTableMap.vm Sat May 14 17:34:23 2011
@@ -31,5 +31,5 @@
     public static TableMap getTableMap()
         throws TorqueException
     {
-        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
+        return ${peerImplGetter}().getTableMap();
     }

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/imports.vm Sat May 14 17:34:23 2011
@@ -47,6 +47,8 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.torque.NoRowsException;
 import org.apache.torque.TooManyRowsException;
 import org.apache.torque.Torque;

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/log.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/log.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/log.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/log.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,31 @@
+## 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.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the base peer class.
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+## The options and the attributes of the current source element must be set
+## as velocity variables.  
+##
+    /** The class log. */
+    private static Log log = LogFactory.getLog(${basePeerImplClassName}.class);
\ No newline at end of file

Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/mapBuilderGetter.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/mapBuilderGetter.vm?rev=1103171&r1=1103170&r2=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/mapBuilderGetter.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/mapBuilderGetter.vm Sat May 14 17:34:23 2011
@@ -36,6 +36,5 @@
     public static MapBuilder getMapBuilder()
         throws TorqueException
     {
-        return Torque.getMapBuilder(
-                ${mapBuilderPackage}.${mapBuilderClassName}.CLASS_NAME);
+        return ${peerImplGetter}().getMapBuilder();
     }

Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm?rev=1103171&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm (added)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplCreator.vm Sat May 14 17:34:23 2011
@@ -0,0 +1,37 @@
+## 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.
+##
+######
+##
+## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
+##
+## Creates the creator method for the peer implementation. 
+## 
+## This template expects the current source element to be a "table" element 
+## from the torque schema.
+## The schema needs to be processed by the OMTransformer.
+##
+    /**
+     * Creates a new instance of the  implementation of the peer.
+     *
+     * @return the new instance.
+     */
+    protected static ${peerImplClassName} create${peerImplClassName}()
+    {
+        return new ${peerImplClassName}();
+    }
+

Copied: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplField.vm (from r1056939, db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm)
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplField.vm?p2=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplField.vm&p1=db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm&r1=1056939&r2=1103171&rev=1103171&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/dbObjectClassConstants.vm (original)
+++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/peerImplField.vm Sat May 14 17:34:23 2011
@@ -19,50 +19,12 @@
 ##
 ## version $Id: MultiExtendBean.vm 240328 2005-08-26 22:02:48 +0200 (Fr, 26 Aug 2005) tfischer $
 ##
-## Creates the constants for the class of the database object. 
+## Creates the field holding the peer implementation. 
 ## 
 ## This template expects the current source element to be a "table" element 
 ## from the torque schema.
 ## The schema needs to be processed by the OMTransformer.
-## The options and the attributes of the current source element must be set
-## as velocity variables.  
 ##
-    /** A class that can be returned by this peer. */
-    protected static final String CLASSNAME_DEFAULT =
-        "${dbObjectPackage}.${dbObjectClassName}";
+    /** The implementation of the peer. */
+    protected static ${peerImplClassName} ${peerImplFieldName};
 
-    /** A class that can be returned by this peer. */
-    protected static final Class<?> CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
-
-#set ($inheritanceColumnBaseElement = $torqueGen.getChild("inheritance-column"))
-#if ($inheritanceColumnBaseElement)
-  #set ( $columnElement = $inheritanceColumnBaseElement.getChild("column") )
-  #set ( $inheritanceElements = $columnElement.getChildren("inheritance"))
-  ## NOTE: this hack requires a class type definition column to
-  ## be a primitive type or a String. Should not be a bad assumption
-  #if ($columnElement.getAttribute("primitive") == "true")
-    #set ($quote = "")
-  #else
-    #set ($quote = '"')
-  #end
-  #set ( $columnFieldType = $columnElement.getAttribute("fieldType") )
-  #foreach ($inheritanceElement in $inheritanceElements)
-    #set ( $key = $inheritanceElement.getAttribute("key") )
-    #set ( $class = $inheritanceElement.getAttribute("class") )
-    #set ( $classConstant = $inheritanceElement.getAttribute("classConstant") )
-    #set ( $classkeyConstant = $inheritanceElement.getAttribute("classkeyConstant") )
-    #set ( $classnameConstant = $inheritanceElement.getAttribute("classnameConstant") )
-    /** A key representing a particular subclass */
-    public static final $columnFieldType $classkeyConstant =
-        $quote$key$quote;
-
-    /** A class that can be returned by this peer. */
-    public static final String $classnameConstant =
-        "${dbObjectPackage}.$class";
-
-    /** A class that can be returned by this peer. */
-    public static final Class<?> $classConstant =
-        initClass($classnameConstant);
-
-  #end
-#end



---------------------------------------------------------------------
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