Examples of addDescendingOrderByColumn()


Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        Criterion c = new Criterion(BookPeer.TITLE,
                "Book 6 - Author 1", Criteria.GREATER_EQUAL);
        c.and(new Criterion(BookPeer.TITLE,
                "Book 8 - Author 3", Criteria.LESS_EQUAL));
        crit.where(c);
        crit.addDescendingOrderByColumn(BookPeer.BOOK_ID);
        crit.setLimit(10);
        crit.setOffset(5);
        List<Book> books = BookPeer.doSelect(crit);
        assertTrue("List should have 10 books, not " + books.size(),
                books.size() == 10);
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

                     + ", should be \"Book 4\"");
        }

        // test simple descending order by
        criteria = new Criteria();
        criteria.addDescendingOrderByColumn(BookPeer.TITLE);
        bookList = BookPeer.doSelect(criteria);
        if (bookList.size() != 4)
        {
            fail("Descending Order By: "
                     + "incorrect numbers of books found : "
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        criteria.addJoin(
                AuthorPeer.AUTHOR_ID,
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()));
        criteria.addAscendingOrderByColumn(
                new ColumnImpl("b." + BookPeer.TITLE.getColumnName()));
        criteria.addDescendingOrderByColumn(BookPeer.TITLE);
        // the retrieved columns are
        // author    book   b
        // author1  book1   book1
        // author2  book4   book2
        // author2  book3   book2
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        criteria.addJoin(BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID);
        criteria.addJoin(
                AuthorPeer.AUTHOR_ID,
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()));
        criteria.addAscendingOrderByColumn(BookPeer.TITLE);
        criteria.addDescendingOrderByColumn(
                new ColumnImpl("b." + BookPeer.TITLE.getColumnName()));
        // the retrieved columns are
        // author    book   b
        // author1  book1   book1
        // author2  book2   book4
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

     */
    public void testReadWithSort() throws Exception
    {
        // prepare
        Criteria criteria = new Criteria();
        criteria.addDescendingOrderByColumn(QualifiedNamePeer.ID);

        // execute
        List<QualifiedName> qualifiedNames
                = QualifiedNamePeer.doSelect(criteria);

View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        authorIds.add(author1.getName());
        authorIds.add(author2.getName());
        subquery.where(AuthorPeer.NAME, authorIds, Criteria.IN);
        Criteria criteria = new Criteria();
        criteria.where(AuthorPeer.AUTHOR_ID, subquery, Criteria.IN);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

        List<?> result = AuthorPeer.doSelect(criteria);
        assertEquals("Expected result of size 2 but got " + result.size(),
                result.size(),
                3);
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        Criteria subquery = new Criteria();
        subquery.addSelectColumn(AuthorPeer.AUTHOR_ID);
        subquery.where(author1.getName(), AuthorPeer.NAME);
        Criteria criteria = new Criteria();
        criteria.where(subquery, AuthorPeer.AUTHOR_ID);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

        List<?> result = AuthorPeer.doSelect(criteria);
        assertEquals("Expected result of size 1 but got " + result.size(),
                1,
                result.size());
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        Criteria criteria = new Criteria();
        List<String> nameList = new ArrayList<String>();
        nameList.add("Author 1");
        nameList.add("Author 2");
        criteria.where(AuthorPeer.NAME, nameList, Criteria.IN);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

        List<Author> result = AuthorPeer.doSelect(criteria);
        assertEquals("Expected result of size 2 but got " + result.size(),
                2,
                result.size());
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

        Criteria criteria = new Criteria();
        List<Integer> idList = new ArrayList<Integer>();
        idList.add(authorList.get(0).getAuthorId());
        idList.add(authorList.get(1).getAuthorId());
        criteria.where(AuthorPeer.AUTHOR_ID, idList, Criteria.IN);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

        List<Author> result = AuthorPeer.doSelect(criteria);
        assertEquals("Expected result of size 2 but got " + result.size(),
                2,
                result.size());
View Full Code Here

Examples of org.apache.torque.criteria.Criteria.addDescendingOrderByColumn()

    public void testInWithStringArrayIgnoreCaseFalse() throws Exception
    {
        Criteria criteria = new Criteria();
        String[] nameArray = new String[] {"Author 1", "Author 3"};
        criteria.where(AuthorPeer.NAME, nameArray, Criteria.IN);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

        List<Author> result = AuthorPeer.doSelect(criteria);
        assertEquals("Expected result of size 2 but got " + result.size(),
                result.size(),
                2);
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.