Package org.apache.torque.criteria

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


            // failing is "expected", so bypass without error
        }
        else
        {
            criteria = new Criteria();
            criteria.where(AuthorPeer.NAME, author.getName());
            result = AuthorPeer.doSelect(criteria);
            assertTrue("Size of result is not 1, but " + result.size(),
                    result.size() == 1);

            // again check LIKE treatment
View Full Code Here


            assertTrue("Size of result is not 1, but " + result.size(),
                    result.size() == 1);

            // again check LIKE treatment
            criteria = new Criteria();
            criteria.where(
                    AuthorPeer.NAME,
                    author.getName().replace('r', '%'),
                    Criteria.LIKE);
            result = AuthorPeer.doSelect(criteria);
            assertTrue("Size of result is not 1, but " + result.size(),
View Full Code Here

                    AuthorPeer.NAME,
                    author.getName().toLowerCase(),
                    Criteria.EQUAL);
            criterion2.setIgnoreCase(true);
            criterion1.and(criterion2);
            criteria.where(criterion1);

            result = AuthorPeer.doSelect(criteria);
            assertTrue("Size of result is not 1, but " + result.size(),
                    result.size() == 1);
View Full Code Here

            // ignore case in "in" query
            {
                criteria = new Criteria();
                Set<String> names = new HashSet<String>();
                names.add(author.getName());
                criteria.where(AuthorPeer.NAME, names, Criteria.IN);

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

        if (count != 2) {
            fail("counted " + count + " distinct datasets, should be 2 ");
        }

        criteria = new Criteria();
        criteria.where(AuthorPeer.NAME, "Name2");
        count = new CountHelper().count(criteria);

        if (count != 1) {
            fail("counted " + count + " datasets with name Name2,"
                 + " should be 1 ");
View Full Code Here

     * @throws Exception if the test fails
     */
    public void testInterface() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.where(IfcTablePeer.ID, -1, Criteria.NOT_EQUAL);
        IfcTablePeer.doDelete(criteria);

        IfcTable ifc = new IfcTable();

        assertTrue("IfcTable should be an instance of TestInterface", ifc instanceof TestInterface);
View Full Code Here

    public void testInheritanceWithKeys() throws Exception
    {
        // make sure that the InheritanceTest table is empty before the test
        Criteria criteria = new Criteria();
        criteria.where(
                InheritanceTestPeer.INHERITANCE_TEST,
                (Object) null,
                Criteria.ISNOTNULL);
        InheritanceTestPeer.doDelete(criteria);
        criteria = new Criteria();
View Full Code Here

                InheritanceTestPeer.INHERITANCE_TEST,
                (Object) null,
                Criteria.ISNOTNULL);
        InheritanceTestPeer.doDelete(criteria);
        criteria = new Criteria();
        criteria.where(
                InheritanceTestPeer.INHERITANCE_TEST,
                (Object) null,
                Criteria.ISNOTNULL);
        assertEquals(0,
                new CountHelper().count(criteria));
View Full Code Here

        inheritanceChildD.setPayload("payload 4");
        inheritanceChildD.save();

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

    {
        // make sure that the InheritanceTest table is empty before the test
        Criteria criteria = new Criteria();
        InheritanceClassnameTestPeer.doDelete(criteria);
        criteria = new Criteria();
        criteria.where(
                InheritanceClassnameTestPeer.INHERITANCE_TEST,
                null,
                Criteria.ISNOTNULL);
        assertEquals(0,
                new CountHelper().count(criteria));
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.