cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r811810 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/
Date Sun, 06 Sep 2009 11:15:06 GMT
Author: aadamchik
Date: Sun Sep  6 11:15:06 2009
New Revision: 811810

URL: http://svn.apache.org/viewvc?rev=811810&view=rev
Log:
CAY-1268 Implement 'setStatementFetchSize' for RelationshipQuery

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RelationshipQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=811810&r1=811809&r2=811810&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Sep  6 11:15:06 2009
@@ -25,6 +25,7 @@
 CAY-1241 Add method to ExpressionFactory to match against the primary key of an object or
list of objects
 CAY-1254 filtering an inExp(a, b) does not work when the path (a) refers to a collection
of objects
 CAY-1261 Auto-inject values in NEW objects with declared qualifiers
+CAY-1268 Implement 'setStatementFetchSize' for RelationshipQuery
 
 Bug Fixes Since M6:
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RelationshipQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RelationshipQuery.java?rev=811810&r1=811809&r2=811810&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RelationshipQuery.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/RelationshipQuery.java
Sun Sep  6 11:15:06 2009
@@ -42,6 +42,7 @@
     protected ObjectId objectId;
     protected String relationshipName;
     protected boolean refreshing;
+    protected int statementFetchSize;
 
     protected transient EntityResolver metadataResolver;
     protected transient QueryMetadata metadata;
@@ -121,7 +122,11 @@
         Expression qualifier = ExpressionFactory.matchDbExp(relationship
                 .getReverseDbRelationshipPath(), objectId);
 
-        return new SelectQuery((ObjEntity) relationship.getTargetEntity(), qualifier);
+        SelectQuery query = new SelectQuery(
+                (ObjEntity) relationship.getTargetEntity(),
+                qualifier);
+        query.setStatementFetchSize(statementFetchSize);
+        return query;
     }
 
     /**
@@ -170,6 +175,11 @@
                 public ClassDescriptor getClassDescriptor() {
                     return arc.getTargetDescriptor();
                 }
+
+                @Override
+                public int getStatementFetchSize() {
+                    return statementFetchSize;
+                }
             };
 
             this.metadataResolver = resolver;
@@ -177,6 +187,23 @@
     }
 
     /**
+     * Sets statement's fetch size (0 for no default size)
+     * 
+     * @since 3.0
+     */
+    public void setStatementFetchSize(int size) {
+        this.statementFetchSize = size;
+    }
+
+    /**
+     * @return statement's fetch size
+     * @since 3.0
+     */
+    public int getStatementFetchSize() {
+        return statementFetchSize;
+    }
+
+    /**
      * Overrides toString() outputting a short string with query class and relationship
      * name.
      */

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java?rev=811810&r1=811809&r2=811810&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/query/StatementFetchSizeTest.java
Sun Sep  6 11:15:06 2009
@@ -19,6 +19,7 @@
 package org.apache.cayenne.query;
 
 import org.apache.art.Artist;
+import org.apache.cayenne.ObjectId;
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.unit.CayenneCase;
 
@@ -43,5 +44,12 @@
         
         assertEquals(10, ejbql.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
         dataContext.performQuery(ejbql);
+        
+        ObjectId id = new ObjectId("Artist", Artist.ARTIST_ID_PK_COLUMN, 1);
+        RelationshipQuery relationshipQuery = new RelationshipQuery(id, Artist.PAINTING_ARRAY_PROPERTY,
true);
+        relationshipQuery.setStatementFetchSize(10);
+        
+        assertEquals(10, relationshipQuery.getMetaData(dataContext.getEntityResolver()).getStatementFetchSize());
+        dataContext.performQuery(relationshipQuery);
     }
 }



Mime
View raw message