Author: tv
Date: Thu Aug 9 18:44:09 2012
New Revision: 1371371
URL: http://svn.apache.org/viewvc?rev=1371371&view=rev
Log:
Removed methods that could be moved to BasePeerImpl
Modified:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doDelete.vm
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm
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=1371371&r1=1371370&r2=1371371&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
Thu Aug 9 18:44:09 2012
@@ -28,59 +28,6 @@
## as velocity variables.
##
/**
- * Deletes rows from a database table.
- *
- * @param criteria defines the rows to be deleted, not null.
- *
- * @return the number of deleted rows.
- *
- * @throws TorqueException Any exceptions caught during processing will be
- * rethrown wrapped into a TorqueException.
- */
- public int doDelete(Criteria criteria) throws TorqueException
- {
- Connection connection = null;
- try
- {
- connection = Transaction.begin(
- ${peerClassName}.DATABASE_NAME);
- int deletedRows = doDelete(criteria, connection);
- Transaction.commit(connection);
- connection = null;
- return deletedRows;
- }
- finally
- {
- if (connection != null)
- {
- Transaction.safeRollback(connection);
- }
- }
- }
-
- /**
- * Deletes rows from a table. This method is to be used
- * during a transaction, otherwise use the doDelete(Criteria) method.
- *
- * @param criteria defines the rows to be deleted, not null.
- * @param con the connection to use, not null.
- *
- * @return the number of deleted rows.
- *
- * @throws TorqueException Any exceptions caught during processing will be
- * rethrown wrapped into a TorqueException.
- */
- public int doDelete(Criteria criteria, Connection con)
- throws TorqueException
- {
- correctBooleans(criteria);
-
- setDbName(criteria);
-
- return doDelete(criteria, getTableMap(), con);
- }
-
- /**
* Deletes a data object, i.e. a row in a table, in the database.
*
* @param obj the data object to delete in the database, not null.
@@ -94,7 +41,7 @@
{
#set ( $primaryKeyColumnElements =
$torqueGen.getChild("primary-keys").getChildren("column"))
#if ($primaryKeyColumnElements.size() > 0)
- int result = doDelete(buildCriteria(obj.getPrimaryKey()));
+ int result = doDelete(buildCriteria(obj.getPrimaryKey()),
getTableMap());
#else
int result = doDelete(buildSelectCriteria(obj), getTableMap());
#end
Modified:
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/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/impl/base/doSelect.vm?rev=1371371&r1=1371370&r2=1371371&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm
(original)
+++
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/templates/peer/impl/base/doSelect.vm
Thu Aug 9 18:44:09 2012
@@ -28,61 +28,6 @@
## as velocity variables.
##
/**
- * Selects ${dbObjectClassName} objects from a database.
- *
- * @param criteria object used to create the SELECT statement.
- *
- * @return the list of selected objects, not null.
- *
- * @throws TorqueException Any exceptions caught during processing will be
- * rethrown wrapped into a TorqueException.
- */
- public List<${dbObjectClassName}> doSelect(Criteria criteria)
- throws TorqueException
- {
- if (criteria.getSelectColumns().size() == 0)
- {
- addSelectColumns(criteria);
- }
- setDbName(criteria);
-
- return doSelect(
- criteria,
- new $recordMapperClassName(),
- getTableMap());
- }
-
- /**
- * Selects ${dbObjectClassName} objects from a database
- * within a transaction.
- *
- * @param criteria object used to create the SELECT statement.
- * @param connection the connection to use, not null.
- *
- * @return the list of selected objects, not null.
- *
- * @throws TorqueException Any exceptions caught during processing will be
- * rethrown wrapped into a TorqueException.
- */
- public List<${dbObjectClassName}> doSelect(
- Criteria criteria,
- Connection connection)
- throws TorqueException
- {
- if (criteria.getSelectColumns().size() == 0)
- {
- addSelectColumns(criteria);
- }
- setDbName(criteria);
-
- return doSelect(
- criteria,
- new $recordMapperClassName(),
- getTableMap(),
- connection);
- }
-
- /**
* Selects ${dbObjectClassName} objects from the database which have
* the same content as the passed object.
*
@@ -99,66 +44,6 @@
#if (${addSelectSingleRecordMethods} == "true")
/**
- * Selects at most one ${dbObjectClassName} object from a database.
- *
- * @param criteria object used to create the SELECT statement.
- *
- * @return the selected Object, or null if no object was selected.
- *
- * @throws TorqueException If more than one record is selected or if
- * an error occurs when processing the query.
- */
- public ${dbObjectClassName} doSelectSingleRecord(
- Criteria criteria)
- throws TorqueException
- {
- List<${dbObjectClassName}> ${field}List = doSelect(criteria);
- ${dbObjectClassName} ${field} = null;
- if (${field}List.size() > 1)
- {
- throw new TooManyRowsException("Criteria " + criteria
- + " matched more than one record");
- }
- if (!${field}List.isEmpty())
- {
- ${field} = ${field}List.get(0);
- }
- return ${field};
- }
-
- /**
- * Selects at most one ${dbObjectClassName} object from a database
- * within a transaction.
- *
- * @param criteria object used to create the SELECT statement.
- * @param connection the connection holding the transaction, not null.
- *
- * @return the selected Object, or null if no object was selected.
- *
- * @throws TorqueException If more than one record is selected or if
- * an error occurs when processing the query.
- */
- public ${dbObjectClassName} doSelectSingleRecord(
- Criteria criteria,
- Connection connection)
- throws TorqueException
- {
- List<${dbObjectClassName}> ${field}List
- = doSelect(criteria, connection);
- ${dbObjectClassName} ${field} = null;
- if (${field}List.size() > 1)
- {
- throw new TooManyRowsException("Criteria " + criteria
- + " matched more than one record");
- }
- if (!${field}List.isEmpty())
- {
- ${field} = ${field}List.get(0);
- }
- return ${field};
- }
-
- /**
* Selects at most one ${dbObjectClassName} object from the database
* which has the same content as the passed object.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]