Package org.apache.torque.criteria

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


            return;
        }

        Criteria subquery = new Criteria();
        subquery.addSelectColumn(new ColumnImpl("count(*)"));
        subquery.where(BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID);
        subquery.and(BookPeer.TITLE, book3.getTitle());
        subquery.addFrom(BookPeer.TABLE_NAME);
        Criteria criteria = new Criteria();
        criteria.where(subquery, 1);

View Full Code Here


        subquery.addSelectColumn(new ColumnImpl("count(*)"));
        subquery.where(BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID);
        subquery.and(BookPeer.TITLE, book3.getTitle());
        subquery.addFrom(BookPeer.TABLE_NAME);
        Criteria criteria = new Criteria();
        criteria.where(subquery, 1);

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

    {
        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,
View Full Code Here

    {
        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,
View Full Code Here

        Criteria criteria = new Criteria();
        List<String> isbnList = new ArrayList<String>();

        isbnList.add("ISBN 1 - 1");
        isbnList.add(null);
        criteria.where(BookPeer.ISBN, isbnList, Criteria.IN);
        criteria.addAscendingOrderByColumn(BookPeer.BOOK_ID);

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

     */
    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(),
View Full Code Here

    {
        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.setIgnoreCase(true);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

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

    {
        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.setIgnoreCase(true);
        criteria.addDescendingOrderByColumn(AuthorPeer.AUTHOR_ID);

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

     */
    public void testignoreCaseUnknownColumnType() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(new ColumnImpl("unknownTable.column1"));
        criteria.where(new ColumnImpl("column1"), "1");
        criteria.setIgnoreCase(true);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals(
                "SELECT unknownTable.column1 FROM unknownTable "
                   + "WHERE UPPER(column1)=UPPER(?)",
View Full Code Here

    public void testIgnoreCaseStringColumnType() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(stringColumnMap);
        criteria.where(stringColumnMap, "1");
        criteria.setIgnoreCase(true);
        Query query = SqlBuilder.buildQuery(criteria);
        assertEquals(
                "SELECT TABLE.COLUMN1 FROM TABLE "
                   + "WHERE UPPER(TABLE.COLUMN1)=UPPER(?)",
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.