You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2008/10/06 12:03:10 UTC
svn commit: r702071 - in
/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache:
art/ClobTestRelation.java art/auto/_ClobTestRelation.java
cayenne/access/jdbc/SelectActionTest.java
Author: aadamchik
Date: Mon Oct 6 03:03:09 2008
New Revision: 702071
URL: http://svn.apache.org/viewvc?rev=702071&view=rev
Log:
CAY-1110 fetchLimit + DistinctResultIterator = fewer rows in the result (unit test patch by Dima Loiko to demonstrate the problem)
Added:
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ClobTestRelation.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ClobTestRelation.java
cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ClobTestRelation.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ClobTestRelation.java?rev=702071&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ClobTestRelation.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/ClobTestRelation.java Mon Oct 6 03:03:09 2008
@@ -0,0 +1,7 @@
+package org.apache.art;
+
+import org.apache.art.auto._ClobTestRelation;
+
+public class ClobTestRelation extends _ClobTestRelation {
+
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ClobTestRelation.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ClobTestRelation.java?rev=702071&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ClobTestRelation.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/art/auto/_ClobTestRelation.java Mon Oct 6 03:03:09 2008
@@ -0,0 +1,43 @@
+package org.apache.art.auto;
+
+import org.apache.art.ClobTestEntity;
+import org.apache.cayenne.CayenneDataObject;
+
+/**
+ * Class _ClobTestRelation was generated by Cayenne.
+ * It is probably a good idea to avoid changing this class manually,
+ * since it may be overwritten next time code is regenerated.
+ * If you need to make any customizations, please use subclass.
+ */
+public abstract class _ClobTestRelation extends CayenneDataObject {
+
+ public static final String ID_PROPERTY = "id";
+ public static final String VALUE_PROPERTY = "value";
+ public static final String CLOB_ID_PROPERTY = "clobId";
+
+ public static final String ID_PK_COLUMN = "ID";
+
+ public void setId(Integer id) {
+ writeProperty("id", id);
+ }
+ public Integer getId() {
+ return (Integer)readProperty("id");
+ }
+
+ public void setValue(Integer value) {
+ writeProperty("value", value);
+ }
+ public Integer getValue() {
+ return (Integer)readProperty("value");
+ }
+
+ public void setClobId(ClobTestEntity clobId) {
+ setToOneTarget("clobId", clobId, true);
+ }
+
+ public ClobTestEntity getClobId() {
+ return (ClobTestEntity)readProperty("clobId");
+ }
+
+
+}
Added: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java?rev=702071&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java (added)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java Mon Oct 6 03:03:09 2008
@@ -0,0 +1,97 @@
+/*****************************************************************
+ * 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.
+ ****************************************************************/
+package org.apache.cayenne.access.jdbc;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.List;
+
+
+import org.apache.art.ClobTestEntity;
+import org.apache.art.ClobTestRelation;
+import org.apache.cayenne.DataRow;
+import org.apache.cayenne.access.DataContext;
+import org.apache.cayenne.access.MockDataNode;
+import org.apache.cayenne.access.ResultIterator;
+import org.apache.cayenne.access.trans.SelectTranslator;
+import org.apache.cayenne.access.types.ExtendedTypeMap;
+import org.apache.cayenne.access.util.DistinctResultIterator;
+import org.apache.cayenne.exp.Expression;
+import org.apache.cayenne.query.SelectQuery;
+import org.apache.cayenne.unit.CayenneCase;
+
+
+
+
+public class SelectActionTest extends CayenneCase {
+
+ protected DataContext context;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ deleteTestData();
+ context = getDomain().createDataContext();
+ }
+
+ public void testFetchLimit_DistinctResultIterator() throws Exception{
+ insertClobDb();
+
+ Expression qual = Expression.fromString("clobValue.value = 100");
+ SelectQuery select = new SelectQuery(ClobTestEntity.class, qual);
+ select.setFetchLimit(25);
+ List<DataRow> resultRows = context.performQuery(select);
+
+ assertNotNull(resultRows);
+ //assertEquals(25, resultRows.size());
+ }
+
+ protected void insertClobDb(){
+ ClobTestEntity obj ;
+ for(int i=0;i<80;i++){
+ if (i < 20){
+ obj = (ClobTestEntity) context.newObject("ClobTestEntity");
+ obj.setClobCol("a1"+i);
+ insetrClobRel(obj);
+ }
+ else{
+ obj = (ClobTestEntity) context.newObject("ClobTestEntity");
+ obj.setClobCol("a2");
+ insetrClobRel(obj);
+ }
+ }
+
+ context.commitChanges();
+ }
+
+ protected void insetrClobRel(ClobTestEntity clobId){
+ ClobTestRelation obj;
+
+ for(int i = 0;i<20 ;i++){
+ obj = (ClobTestRelation) context.newObject("ClobTestRelation");
+ obj.setValue(100);
+ obj.setClobId(clobId);
+ }
+ }
+
+
+}