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=1374905&r1=1374904&r2=1374905&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 Mon Aug 20 03:24:18 2012 @@ -64,6 +64,98 @@ } /** + * Selects rows from a database an maps them to objects. + * + * @param criteria A Criteria specifying the records to select, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * + * @return The results of the query, not null. + * + * @throws TorqueException if querying the database fails. + */ + public static <T> List<T> doSelect( + Criteria criteria, + RecordMapper<T> mapper) + throws TorqueException + { + return ${peerImplGetter}().doSelect(criteria, mapper); + } + + /** + * Selects rows from a database an maps them to objects. + * + * @param criteria A Criteria specifying the records to select, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * @param connection the database connection for selecting records, + * not null. + * + * @return The results of the query, not null. + * @throws TorqueException Error performing database query. + */ + public static <T> List<T> doSelect( + Criteria criteria, + RecordMapper<T> mapper, + Connection connection) + throws TorqueException + { + return ${peerImplGetter}().doSelect( + criteria, + mapper, + connection); + } + + /** + * Selects rows from a database an maps them to objects. + * + * @param query the sql query to execute, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * @param dbName The name of the database to create the connection for, + * or null for the default SDB. + * + * @return The results of the query, not null. + * + * @throws TorqueException if querying the database fails. + */ + public static <T> List<T> doSelect( + String query, + RecordMapper<T> mapper, + String dbName) + throws TorqueException + { + return ${peerImplGetter}().doSelect( + query, + mapper, + dbName); + } + + /** + * Selects rows from a database an maps them to objects. + * + * @param query the SQL Query to execute, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * @param connection the database connection, not null. + * + * @return The results of the query, not null. + * + * @throws TorqueException if querying the database fails. + */ + public static <T> List<T> doSelect( + String query, + RecordMapper<T> mapper, + Connection connection) + throws TorqueException + { + return ${peerImplGetter}().doSelect( + query, + mapper, + connection); + } + + /** * Selects ${dbObjectClassName} objects from the database which have * the same content as the passed object. * @@ -117,6 +209,51 @@ } /** + * Selects at most a single row from a database an maps them to objects. + * + * @param criteria A Criteria specifying the records to select, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * + * @return The selected row, or null if no records was selected. + * + * @throws TorqueException if querying the database fails. + */ + public static <T> T doSelectSingleRecord( + org.apache.torque.criteria.Criteria criteria, + RecordMapper<T> mapper) + throws TorqueException + { + return ${peerImplGetter}().doSelectSingleRecord( + criteria, + mapper); + } + + /** + * Selects at most a single row from a database an maps them to objects. + * + * @param criteria A Criteria specifying the records to select, not null. + * @param mapper The mapper creating the objects from the resultSet, + * not null. + * @param connection the database connection, not null. + * + * @return The selected row, or null if no records was selected. + * + * @throws TorqueException if querying the database fails. + */ + public static <T> T doSelectSingleRecord( + org.apache.torque.criteria.Criteria criteria, + RecordMapper<T> mapper, + Connection connection) + throws TorqueException + { + return ${peerImplGetter}().doSelectSingleRecord( + criteria, + mapper, + connection); + } + + /** * Selects at most one ${dbObjectClassName} object from the database * which has the same content as the passed object. *
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=1374905&r1=1374904&r2=1374905&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 Mon Aug 20 03:24:18 2012 @@ -61,6 +61,53 @@ } /** + * Executes an update against the database. The rows to be updated + * are selected using <code>criteria</code> and updated using the values + * in <code>updateValues</code>. + * + * @param criteria selects which rows of which table should be updated. + * @param updateValues Which columns to update with which values, not null. + * + * @return the number of affected rows. + * + * @throws TorqueException if updating fails. + */ + public static int doUpdate( + Criteria selectCriteria, + ColumnValues updateValues) + throws TorqueException + { + return ${peerImplGetter}().doUpdate( + selectCriteria, + updateValues); + } + + /** + * Executes an update against the database. The rows to be updated + * are selected using <code>criteria</code> and updated using the values + * in <code>updateValues</code>. + * + * @param criteria selects which rows of which table should be updated. + * @param updateValues Which columns to update with which values, not null. + * @param connection the database connection to use, not null. + * + * @return the number of affected rows. + * + * @throws TorqueException if updating fails. + */ + public static int doUpdate( + Criteria criteria, + ColumnValues updateValues, + Connection connection) + throws TorqueException + { + return ${peerImplGetter}().doUpdate( + criteria, + updateValues, + connection); + } + + /** * Updates an $dbObjectClassName in the database. * The primary key is used to identify the object to update. * Added: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/executeStatement.vm URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/executeStatement.vm?rev=1374905&view=auto ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/executeStatement.vm (added) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/base/executeStatement.vm Mon Aug 20 03:24:18 2012 @@ -0,0 +1,78 @@ +## 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: correctBooleans.vm 1331196 2012-04-27 02:56:12Z tfischer $ +## +## Creates the executeStatement methods for the base peer. +## +## 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. +## + /** + * Utility method which executes a given SQL statement. This + * method should be used for update, insert, and delete + * statements. + * + * @param statementString A String with the SQL statement to execute. + * @return The number of rows affected. + * @throws TorqueException Any exceptions caught during processing will be + * rethrown wrapped into a TorqueException. + */ + public static int executeStatement(String statementString) + throws TorqueException + { + return ${peerImplGetter}().executeStatement(statementString); + } + + /** + * Utility method which executes a given sql statement. This + * method should be used for update, insert, and delete + * statements. + * + * @param statementString A String with the sql statement to execute. + * @param dbName Name of database to connect to. + * @return The number of rows affected. + * @throws TorqueException Any exceptions caught during processing will be + * rethrown wrapped into a TorqueException. + */ + public static int executeStatement(String statementString, String dbName) + throws TorqueException + { + return ${peerImplGetter}().executeStatement(statementString, dbName); + } + + /** + * Utility method which executes a given sql statement. This + * method should be used for update, insert, and delete + * statements. + * + * @param statementString A String with the sql statement to execute. + * @param con A Connection. + * @return The number of rows affected. + * @throws TorqueException Any exceptions caught during processing will be + * rethrown wrapped into a TorqueException. + */ + public static int executeStatement(String statementString, Connection con) + throws TorqueException + { + return ${peerImplGetter}().executeStatement(statementString, con); + } Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/buildColumnValues.vm?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/buildColumnValues.vm Mon Aug 20 03:24:18 2012 @@ -41,7 +41,7 @@ public ColumnValues buildColumnValues($dbObjectClassName $field) throws TorqueException { - ColumnValues columnValues = new ColumnValues(getTableMap()); + ColumnValues columnValues = new ColumnValues(); #foreach ($columnElement in $torqueGen.getChildren("column")) #set ( $peerColumnName = $columnElement.getAttribute("peerColumnName") ) #set ( $getter = $columnElement.getAttribute("getter") ) Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/doDelete.vm?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm Mon Aug 20 03:24:18 2012 @@ -41,9 +41,9 @@ { #set ( $primaryKeyColumnElements = $torqueGen.getChild("primary-keys").getChildren("column")) #if ($primaryKeyColumnElements.size() > 0) - int result = doDelete(buildCriteria(obj.getPrimaryKey()), getTableMap()); + int result = doDelete(buildCriteria(obj.getPrimaryKey())); #else - int result = doDelete(buildSelectCriteria(obj), getTableMap()); + int result = doDelete(buildSelectCriteria(obj)); #end #if ($trackDeleted == "true") obj.setDeleted(true); @@ -68,9 +68,9 @@ throws TorqueException { #if ($primaryKeyColumnElements.size() > 0) - int result = doDelete(buildCriteria(obj.getPrimaryKey()), getTableMap(), con); + int result = doDelete(buildCriteria(obj.getPrimaryKey()), con); #else - int result = doDelete(buildSelectCriteria(obj), getTableMap(), con); + int result = doDelete(buildSelectCriteria(obj), con); #end #if ($trackDeleted == "true") obj.setDeleted(true); @@ -93,7 +93,7 @@ public int doDelete(Collection<${dbObjectClassName}> objects) throws TorqueException { - int result = doDelete(buildPkCriteria(objects), getTableMap()); + int result = doDelete(buildPkCriteria(objects)); #if ($trackDeleted == "true") for (${dbObjectClassName} object : objects) { @@ -123,7 +123,7 @@ Connection con) throws TorqueException { - int result = doDelete(buildPkCriteria(objects), getTableMap(), con); + int result = doDelete(buildPkCriteria(objects), con); #if ($trackDeleted == "true") for (${dbObjectClassName} object : objects) { @@ -180,6 +180,6 @@ public int doDelete(ObjectKey pk, Connection con) throws TorqueException { - return doDelete(buildCriteria(pk), getTableMap(), con); + return doDelete(buildCriteria(pk), con); } #end Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/doSelectJoin.vm?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoin.vm Mon Aug 20 03:24:18 2012 @@ -111,7 +111,7 @@ List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>(); List<List<Object>> rawResult = doSelect( - criteria, compositeMapper, getTableMap(), conn); + criteria, compositeMapper, conn); for (List<Object> rawResultRow : rawResult) { $dbObjectClassName obj1 = ($dbObjectClassName) rawResultRow.get(0); Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/doSelectJoinAllExcept.vm?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelectJoinAllExcept.vm Mon Aug 20 03:24:18 2012 @@ -126,7 +126,7 @@ List<$dbObjectClassName> result = new ArrayList<$dbObjectClassName>(); List<List<Object>> rawResult = doSelect( - criteria, compositeMapper, getTableMap(), conn); + criteria, compositeMapper, conn); for (List<Object> rawResultRow : rawResult) { $dbObjectClassName $tableField = ($dbObjectClassName) rawResultRow.get(0); Modified: db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/imports.vm?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm (original) +++ db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/imports.vm Mon Aug 20 03:24:18 2012 @@ -61,7 +61,6 @@ import org.apache.torque.TorqueException import org.apache.torque.TorqueRuntimeException; import $torqueGen.option("torque.om.criteriaClass"); import $torqueGen.option("torque.om.criterionClass"); -import org.apache.torque.map.TableMap; import org.apache.torque.om.mapper.RecordMapper; import org.apache.torque.om.mapper.CompositeMapper; import org.apache.torque.om.DateKey; Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/BaseDatabaseTestCase.java Mon Aug 20 03:24:18 2012 @@ -54,6 +54,7 @@ public abstract class BaseDatabaseTestCa * Initialize Torque on the first setUp(). Subclasses which override * setUp() must call super.setUp() as their first action. */ + @Override public void setUp() throws Exception { synchronized (BaseDatabaseTestCase.class) @@ -86,7 +87,6 @@ public abstract class BaseDatabaseTestCa List<String> records = BasePeer.doSelect( "show variables like \"version\"", new StringMapper(1), - (TableMap) null, (String) null); return records.get(0); } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DataTest.java Mon Aug 20 03:24:18 2012 @@ -76,6 +76,7 @@ import org.apache.torque.test.NopkPeer; import org.apache.torque.test.NullValueTable; import org.apache.torque.test.NullValueTablePeer; import org.apache.torque.util.BasePeer; +import org.apache.torque.util.BasePeerImpl; import org.apache.torque.util.CountHelper; import org.apache.torque.util.Transaction; @@ -425,13 +426,13 @@ public class DataTest extends BaseDataba Criteria criteria = new Criteria(); criteria.addSelectColumn( new ColumnImpl("count(distinct(" + BookPeer.BOOK_ID + "))")); - BasePeer.doSelect(criteria, new IntegerMapper(), null); + BasePeer.doSelect(criteria, new IntegerMapper()); // test qualifiers in function in select columns criteria = new Criteria(); criteria.addSelectColumn( new ColumnImpl("count(distinct " + BookPeer.BOOK_ID + ")")); - BasePeer.doSelect(criteria, new IntegerMapper(), null); + BasePeer.doSelect(criteria, new IntegerMapper()); } /** @@ -444,7 +445,7 @@ public class DataTest extends BaseDataba criteria.addSelectColumn(BookPeer.BOOK_ID); - BasePeer.doSelect(criteria, new IntegerMapper(), null); + BasePeer.doSelect(criteria, new IntegerMapper()); } /** @@ -462,7 +463,7 @@ public class DataTest extends BaseDataba try { Criteria criteria = new Criteria(); - BasePeer.doSelect(criteria, new IntegerMapper(), null, null); + AuthorPeer.doSelect(criteria, new IntegerMapper(), null); fail("NullPointerException expected"); } catch (NullPointerException e) @@ -760,7 +761,7 @@ public class DataTest extends BaseDataba author.setName("author"); author.save(); - Adapter adapter = Torque.getDB(Torque.getDefaultDB()); + Adapter adapter = Torque.getAdapter(Torque.getDefaultDB()); if (adapter instanceof MysqlAdapter || adapter instanceof MssqlAdapter) { @@ -868,7 +869,7 @@ public class DataTest extends BaseDataba // we need an additional column to select from, // to indicate the table we want use criteria.addSelectColumn(AuthorPeer.AUTHOR_ID); - BasePeer.doSelect(criteria, new DoNothingMapper(), null); + BasePeer.doSelect(criteria, new DoNothingMapper()); } /** @@ -906,7 +907,7 @@ public class DataTest extends BaseDataba BookPeer.numColumns); List<List<Object>> queryResult - = BookPeer.doSelect(criteria, mapper, null); + = BookPeer.doSelect(criteria, mapper); List<Object> mappedRow = queryResult.get(0); book = (Book) mappedRow.get(0); author = (Author) mappedRow.get(1); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/DocsTest.java Mon Aug 20 03:24:18 2012 @@ -63,6 +63,7 @@ public class DocsTest extends BaseDataba private static Log log = LogFactory.getLog(DocsTest.class); + @Override public void setUp() throws Exception { super.setUp(); @@ -224,7 +225,6 @@ public class DocsTest extends BaseDataba + "INNER JOIN author " + "ON book.AUTHOR_ID=author.AUTHOR_ID", new ObjectListMapper(), - (TableMap) null, (String) null); } catch (Exception e) @@ -247,7 +247,6 @@ public class DocsTest extends BaseDataba "SELECT book.* FROM book,author " + "WHERE book.AUTHOR_ID=author.AUTHOR_ID", new ObjectListMapper(), - (TableMap) null, (String) null); } catch (Exception e) Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/datatypes/BooleanIntCharTest.java Mon Aug 20 03:24:18 2012 @@ -469,7 +469,7 @@ public class BooleanIntCharTest extends .where("BooleanCheck.bint_value", true) .and("BooleanCheck.bchar_value", true); - BasePeer.correctBooleans(criteria, null); + BasePeer.correctBooleans(criteria); Criterion criterionBool1 = criteria.getTopLevelCriterion().getParts().get(0); @@ -495,8 +495,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -534,8 +533,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -573,8 +571,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -612,8 +609,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -651,8 +647,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -688,10 +683,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - // prepare - fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("new", Types.VARCHAR)); @@ -727,8 +719,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("f1", Types.VARCHAR)); @@ -766,8 +757,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("f1", Types.VARCHAR)); @@ -805,8 +795,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("t1", Types.VARCHAR)); @@ -844,8 +833,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("t1", Types.VARCHAR)); @@ -883,8 +871,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("t1", Types.VARCHAR)); @@ -914,10 +901,7 @@ public class BooleanIntCharTest extends { // prepare fillTables(); - // prepare - fillTables(); - ColumnValues columnValues - = new ColumnValues(BintBcharValuePeer.getTableMap()); + ColumnValues columnValues = new ColumnValues(); columnValues.put( BintBcharValuePeer.ID, new JdbcTypedValue("t1", Types.VARCHAR)); Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/generated/peer/SelectFunctionTest.java Mon Aug 20 03:24:18 2012 @@ -71,8 +71,7 @@ public class SelectFunctionTest extends new Avg(Summarize1Peer.INT_1)); Integer avg = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(2), avg); } @@ -88,8 +87,7 @@ public class SelectFunctionTest extends new Avg(Summarize1Peer.INT_1, true)); Integer avg = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(3), avg); } @@ -102,10 +100,9 @@ public class SelectFunctionTest extends public void testSelectCount() throws Exception { Criteria criteria = new Criteria().addSelectColumn(new Count("*")); - Integer count = BasePeer.doSelectSingleRecord( + Integer count = Summarize1Peer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(4), count); } @@ -121,8 +118,7 @@ public class SelectFunctionTest extends new Count(Summarize1Peer.INT_1, true)); Integer count = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(2), count); } @@ -138,8 +134,7 @@ public class SelectFunctionTest extends new Min(Summarize1Peer.INT_1)); Integer min = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(1), min); } @@ -155,8 +150,7 @@ public class SelectFunctionTest extends new Max(Summarize1Peer.INT_1)); Integer max = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(5), max); } @@ -172,8 +166,7 @@ public class SelectFunctionTest extends new Sum(Summarize1Peer.INT_1)); Integer sum = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(8), sum); } @@ -189,8 +182,7 @@ public class SelectFunctionTest extends new Sum(Summarize1Peer.INT_1, true)); Integer sum = BasePeer.doSelectSingleRecord( criteria, - new IntegerMapper(), - Summarize1Peer.getTableMap()); + new IntegerMapper()); assertEquals(new Integer(6), sum); } Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/BasePeerTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/BasePeerTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/BasePeerTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/BasePeerTest.java Mon Aug 20 03:24:18 2012 @@ -2,6 +2,7 @@ package org.apache.torque.util; import org.apache.torque.BaseDatabaseTestCase; import org.apache.torque.util.Criteria; +import org.apache.torque.test.AuthorPeer; import org.apache.torque.test.BookPeer; /** @@ -22,6 +23,8 @@ public class BasePeerTest extends BaseDa criteria.add(BookPeer.TITLE, "Book 1 - Author 1"); // execute + BasePeerImpl basePeerImpl = new BasePeerImpl(); + basePeerImpl.setTableMap(AuthorPeer.getTableMap()); int deleted = BasePeer.doDelete(criteria); // verify Modified: db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java?rev=1374905&r1=1374904&r2=1374905&view=diff ============================================================================== --- db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java (original) +++ db/torque/torque4/trunk/torque-test/src/test/java/org/apache/torque/util/LargeSelectTest.java Mon Aug 20 03:24:18 2012 @@ -88,8 +88,7 @@ public class LargeSelectTest extends Bas criteria.addSelectColumn(AuthorPeer.AUTHOR_ID); List<Integer> result = BasePeer.doSelect( criteria, - new IntegerMapper(), - AuthorPeer.getTableMap()); + new IntegerMapper()); assertEquals("Selected rows", TEST_ROWS, result.size()); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
