Package org.apache.torque.criteria

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


        inheritanceClassnameChild2.setPayload("2 child");
        inheritanceClassnameChild2.save();

        // Check that all objects are saved into the InheritanceTest table
        criteria = new Criteria();
        criteria.where(
                InheritanceClassnameTestPeer.INHERITANCE_TEST,
                null,
                Criteria.ISNOTNULL);
        assertEquals("InheritanceClassnameTest table should contain 3 rows",
                3,
View Full Code Here


        Author author = new Author();
        author.setName("Joshua Bloch");
        author.save();

        Criteria criteria = new Criteria();
        criteria.where(AuthorPeer.AUTHOR_ID, (Object) null, Criteria.NOT_EQUAL);
        criteria.and(new ColumnImpl("name"), "Joshua Bloch", Criteria.EQUAL);
        List<Author> authors = AuthorPeer.doSelect(criteria);
        assertEquals(1, authors.size());
    }
View Full Code Here

        // Check authors are in the database
        for (int i = 0; i < authorNames.length; ++i)
        {
            Criteria criteria = new Criteria();
            criteria.where(AuthorPeer.NAME, authorNames[i]);
            List<Author> authorList = AuthorPeer.doSelect(criteria);
            assertEquals(
                    "AuthorList should contain one author"
                        + " when querying for " + authorNames[i],
                    1,
View Full Code Here

        }

        for (Map.Entry<String, String> likeResult : likeResults.entrySet())
        {
            Criteria criteria = new Criteria();
            criteria.where(
                    AuthorPeer.NAME,
                    likeResult.getKey(),
                    Criteria.LIKE);
            List<Author> authorList;
            try
View Full Code Here

        // check that case insensitivity is maintained if
        // a like is replaced with an equals (no wildcard present)
        // This might be a problem for databases which use ILIKE
        Criteria criteria = new Criteria();
        criteria.where(AuthorPeer.NAME, "AbC", Criteria.LIKE);
        criteria.setIgnoreCase(true);
        List<Author> authorList = AuthorPeer.doSelect(criteria);
        assertEquals(
                "AuthorList should contain one author",
                1,
View Full Code Here

                Criteria.LIKE);
        Criterion criterion3 = new Criterion(
                AuthorPeer.NAME,
                "cbc",
                Criteria.LIKE);
        criteria.where(criterion1.or(criterion2).or(criterion3));
        criteria.addAscendingOrderByColumn(AuthorPeer.NAME);
        criteria.setOffset(1);
        criteria.setLimit(1);
        authorList = AuthorPeer.doSelect(criteria);
        assertEquals(
View Full Code Here

     * @throws Exception if the test fails.
     */
    public void testSelectOperatorIsNull() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.where(BookPeer.ISBN, null, Criteria.ISNULL);

        List<Book> books = BookPeer.doSelect(criteria);
        assertEquals(10, books.size());
    }

View Full Code Here

     * @throws Exception if the test fails.
     */
    public void testSelectOperatorIsNullOtherComparison() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.where(BookPeer.ISBN, "xy", Criteria.ISNULL);

        List<Book> books = BookPeer.doSelect(criteria);
        assertEquals(10, books.size());
    }

View Full Code Here

     * @throws Exception if the test fails.
     */
    public void testSelectOperatorIsNotNull() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.where(BookPeer.ISBN, null, Criteria.ISNOTNULL);

        List<Book> books = BookPeer.doSelect(criteria);
        assertEquals(90, books.size());
    }

View Full Code Here

     * @throws Exception if the test fails.
     */
    public void testSelectOperatorIsNotNullOtherComparison() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.where(BookPeer.ISBN, "xy", Criteria.ISNOTNULL);

        List<Book> books = BookPeer.doSelect(criteria);
        assertEquals(90, books.size());
    }

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.