db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1377255 - in /db/torque/torque4/trunk/torque-runtime/src: main/java/org/apache/torque/criteria/FromElement.java test/java/org/apache/torque/criteria/CriteriaTest.java
Date Sat, 25 Aug 2012 10:26:28 GMT
Author: tfischer
Date: Sat Aug 25 10:26:28 2012
New Revision: 1377255

URL: http://svn.apache.org/viewvc?rev=1377255&view=rev
Log:
make FromElement serializable as it is referenced from Criteria

Modified:
    db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java
    db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java

Modified: db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java?rev=1377255&r1=1377254&r2=1377255&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/criteria/FromElement.java
Sat Aug 25 10:26:28 2012
@@ -19,6 +19,7 @@ package org.apache.torque.criteria;
  * under the License.
  */
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -32,8 +33,11 @@ import org.apache.commons.lang.builder.H
  * a join condition and prepared statement replacements.
  * The class is immutable.
  */
-public class FromElement
+public class FromElement implements Serializable
 {
+    /** serial Version UID. */
+    private static final long serialVersionUID = 1L;
+
     /**
      * The fromExpression, e.g. a simple table name or a table name
      * or a subquery with an appended alias name.

Modified: db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java?rev=1377255&r1=1377254&r2=1377255&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java
(original)
+++ db/torque/torque4/trunk/torque-runtime/src/test/java/org/apache/torque/criteria/CriteriaTest.java
Sat Aug 25 10:26:28 2012
@@ -37,6 +37,7 @@ import org.apache.torque.map.TableMap;
 import org.apache.torque.sql.OrderBy;
 import org.apache.torque.sql.Query;
 import org.apache.torque.sql.SqlBuilder;
+import org.apache.torque.util.UniqueList;
 
 /**
  * Test class for Criteria.
@@ -55,6 +56,7 @@ public class CriteriaTest extends BaseTe
     /**
      * Initializes the criteria.
      */
+    @Override
     public void setUp() throws Exception
     {
         super.setUp();
@@ -615,6 +617,7 @@ public class CriteriaTest extends BaseTe
                 new ColumnImpl("Book", "AUTHOR_ID"),
                 Criteria.INNER_JOIN);
         c.where(new ColumnImpl("Author", "NAME"), "author%", Criteria.LIKE);
+        c.addFrom(new FromElement("Author"));
 
         // Some direct Criterion checks
         Criterion cn = c.getTopLevelCriterion();
@@ -670,6 +673,9 @@ public class CriteriaTest extends BaseTe
         assertEquals(new ColumnImpl("Author", "NAME"),
                 asColumnsClone.get("AUTHOR_NAME"));
         assertEquals(c.getAsColumns(), cClone.getAsColumns());
+        List<FromElement>fromElementsClone = new UniqueList<FromElement>();
+        fromElementsClone.add(new FromElement("Author"));
+        assertEquals(c.getFromElements(), fromElementsClone);
 
         // Check Joins
         List<Join> joinsClone = cClone.getJoins();



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