Examples of orderBy()


Examples of org.apache.metamodel.query.Query.orderBy()

        q.from(customersTable, "c");
        q.from(employeeTable, "o");
        SelectItem countrySelect = new SelectItem(countryColumn);
        q.select(countrySelect, new SelectItem(FunctionType.SUM, creditLimitColumn));
        q.groupBy(countryColumn);
        q.orderBy(new OrderByItem(countrySelect));
        q.where(new FilterItem(new SelectItem(employeeNumberColumn1), OperatorType.EQUALS_TO, new SelectItem(
                employeeNumberColumn2)));

        assertEquals(
                "SELECT c.\"COUNTRY\", SUM(c.\"CREDITLIMIT\") FROM PUBLIC.\"CUSTOMERS\" c, PUBLIC.\"EMPLOYEES\" o WHERE c.\"SALESREPEMPLOYEENUMBER\" = o.\"EMPLOYEENUMBER\" GROUP BY c.\"COUNTRY\" ORDER BY c.\"COUNTRY\" ASC",
View Full Code Here

Examples of org.apache.metamodel.query.Query.orderBy()

                str);
    }
   
    public void testRewriteFirstRowWithOrderByClause() throws Exception {
        Query q = new Query().from(table).select(col).setFirstRow(401);
        q.orderBy(col);
        String str = new DB2QueryRewriter(null).rewriteQuery(q);

        assertEquals(
                "SELECT metamodel_subquery.bar FROM (SELECT sch.foo.bar, ROW_NUMBER() OVER( ORDER BY sch.foo.bar ASC) AS metamodel_row_number FROM sch.foo) metamodel_subquery WHERE metamodel_row_number > 400",
                str);
View Full Code Here

Examples of org.apache.metamodel.query.Query.orderBy()

                str);
    }
   
    public void testRewriteFirstRowAndMaxRowsWithOrderByClause() throws Exception {
        Query q = new Query().from(table).select(col).setFirstRow(401).setMaxRows(400);
        q.orderBy(col);
        String str = new DB2QueryRewriter(null).rewriteQuery(q);
        assertEquals(
                "SELECT metamodel_subquery.bar FROM (SELECT sch.foo.bar, ROW_NUMBER() OVER( ORDER BY sch.foo.bar ASC) AS metamodel_row_number FROM sch.foo) metamodel_subquery WHERE metamodel_row_number BETWEEN 401 AND 800",
                str);
    }
View Full Code Here

Examples of org.apache.metamodel.query.Query.orderBy()

        q.select(ageColumn).selectCount();
        q.from(table);
        q.where(ageColumn, OperatorType.GREATER_THAN, 18);
        q.groupBy(ageColumn);
        q.having(FunctionType.COUNT, nameColumn, OperatorType.LESS_THAN, 100);
        q.orderBy(ageColumn);

        final String sql = new DB2QueryRewriter(null).rewriteQuery(q);

        assertEquals("SELECT sch.tab.age, COUNT(*) FROM sch.tab WHERE sch.tab.age > 18 "
                + "GROUP BY sch.tab.age HAVING COUNT(sch.tab.name) < 100 ORDER BY sch.tab.age ASC", sql);
View Full Code Here

Examples of org.apache.metamodel.query.Query.orderBy()

        q.select(dateColumn).selectCount();
        q.from(table);
        q.where(dateColumn, OperatorType.GREATER_THAN, "2012-10-31 08:09:54");
        q.groupBy(dateColumn);
        q.having(FunctionType.COUNT, nameColumn, OperatorType.LESS_THAN, 100);
        q.orderBy(dateColumn);

        final String sql = new DB2QueryRewriter(null).rewriteQuery(q);

        assertEquals("SELECT sch.tab.age, COUNT(*) FROM sch.tab WHERE sch.tab.age > TIMESTAMP ('2012-10-31 08:09:54') "
                + "GROUP BY sch.tab.age HAVING COUNT(sch.tab.name) < 100 ORDER BY sch.tab.age ASC", sql);
View Full Code Here

Examples of org.fluxtream.core.connectors.annotations.ObjectTypeSpec.orderBy()

        objectType.isImageType = ots.isImageType();
        objectType.isDateBased = ots.isDateBased();
        objectType.isMixedType = ots.isMixedType();
        objectType.isClientFacet = ots.clientFacet();
        objectType.visibleClause = ots.visibleClause().equals("")?null:ots.visibleClause();
        objectType.orderBy = ots.orderBy().equals("")?null:ots.orderBy();
        if (ots.extractor() != null && ots.extractor()!=AbstractFacetExtractor.class) {
            connector.addObjectTypeExtractorClass(
                    objectType.value, ots.extractor(),
                    ots.parallel());
        }
View Full Code Here

Examples of org.jboss.arquillian.persistence.ShouldMatchDataSet.orderBy()

         final ExpectedDataSetProvider dataSetProvider = new ExpectedDataSetProvider(metadataExtractor, configurationInstance.get());
         final Method testMethod = afterPersistenceTest.getTestMethod();
         final ShouldMatchDataSet dataSetsToVerify = metadataExtractor.shouldMatchDataSet()
                                                                      .fetchFrom(testMethod);
         final CustomColumnFilter customColumnFilter = metadataExtractor.using(CustomColumnFilter.class).fetchFrom(testMethod);
         final CompareDBUnitData compareDBUnitDataEvent = new CompareDBUnitData(dataSetProvider.getDescriptorsDefinedFor(testMethod), dataSetsToVerify.orderBy(), dataSetsToVerify.excludeColumns());
         if (customColumnFilter != null)
         {
               compareDBUnitDataEvent.add(customColumnFilter.value());
         }
         compareDataEvent.fire(compareDBUnitDataEvent);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.