tfischer 2005/07/02 08:22:32
Modified: src/java/org/apache/torque/util SQLBuilder.java
Criteria.java
xdocs changes.xml
Log:
The asColumns in a Criteria are now added to the SQL select clause in the
same order as they were added to a Criteria.
To achieve this, the return type of the method Criteria.getAsColumns() had to
be changed from Hashtable to Map.
Thanks for Talika Elisabeth Schmitz for the patch.
Revision Changes Path
1.6 +3 -3 db-torque/src/java/org/apache/torque/util/SQLBuilder.java
Index: SQLBuilder.java
===================================================================
RCS file:
/home/cvs/db-torque/src/java/org/apache/torque/util/SQLBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SQLBuilder.java 1 Jun 2005 21:05:03 -0000 1.5
+++ SQLBuilder.java 2 Jul 2005 15:22:32 -0000 1.6
@@ -18,9 +18,9 @@
import java.io.Serializable;
import java.util.HashSet;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
@@ -355,7 +355,7 @@
final Query query)
{
UniqueList querySelectClause = query.getSelectClause();
- Hashtable criteriaAsColumns = criteria.getAsColumns();
+ Map criteriaAsColumns = criteria.getAsColumns();
for (Iterator it = criteriaAsColumns.keySet().iterator();
it.hasNext(); )
{
1.47 +6 -6 db-torque/src/java/org/apache/torque/util/Criteria.java
Index: Criteria.java
===================================================================
RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/Criteria.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- Criteria.java 18 Feb 2005 10:04:37 -0000 1.46
+++ Criteria.java 2 Jul 2005 15:22:32 -0000 1.47
@@ -28,11 +28,11 @@
import java.util.List;
import java.util.Map;
+import org.apache.commons.collections.OrderedMap;
+import org.apache.commons.collections.map.ListOrderedMap;
import org.apache.commons.lang.StringUtils;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.torque.Torque;
import org.apache.torque.adapter.DB;
import org.apache.torque.om.DateKey;
@@ -147,7 +147,7 @@
private UniqueList orderByColumns = new UniqueList();
private UniqueList groupByColumns = new UniqueList();
private Criterion having = null;
- private Hashtable asColumns = new Hashtable(8);
+ private OrderedMap asColumns = ListOrderedMap.decorate(new HashMap());
private List joins = null;
/** The name of the database. */
@@ -266,10 +266,10 @@
/**
* Get the column aliases.
*
- * @return A Hashtable which map the column alias names
+ * @return A Map which map the column alias names
* to the alias clauses.
*/
- public Hashtable getAsColumns()
+ public Map getAsColumns()
{
return asColumns;
}
1.169 +6 -0 db-torque/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/db-torque/xdocs/changes.xml,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -r1.168 -r1.169
--- changes.xml 2 Jul 2005 07:22:33 -0000 1.168
+++ changes.xml 2 Jul 2005 15:22:32 -0000 1.169
@@ -28,6 +28,12 @@
<body>
<release version="3.2-dev" date="in CVS">
+ <action type="update" dev="tfischer" issue="TRQS252">
+ The asColumns in a Criteria are now added to the SQL select clause
+ in the same order as they were added to a Criteria.
+ To achieve this, the return type of the method Criteria.getAsColumns()
+ had to be changed from Hashtable to Map.
+ </action>
<action type="fix" dev="tfischer" issue="TRQS294">
Torque.shutdown() now closes the datasourcee initialized by Torque,
except the Datasource obtained via a JndiDataSourceFactory.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]