Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.NamedQuery


     * counts.
     *
     * @since 1.1
     */
    public int[] performNonSelectingQuery(String queryName) {
        return performNonSelectingQuery(new NamedQuery(queryName));
    }
View Full Code Here


     * array of update counts.
     *
     * @since 1.1
     */
    public int[] performNonSelectingQuery(String queryName, Map<String, ?> parameters) {
        return performNonSelectingQuery(new NamedQuery(queryName, parameters));
    }
View Full Code Here

     */
    public List<?> performQuery(
            String queryName,
            Map parameters,
            boolean expireCachedLists) {
        NamedQuery query = new NamedQuery(queryName, parameters);
        query.setForceNoCache(expireCachedLists);
        return performQuery(query);
    }
View Full Code Here

        Date now = cal.getTime();
        test.setTimestampColumn(now);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectDateTest");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Date columnValue = (Date) testRead.get("TIMESTAMP_COLUMN");
        assertNotNull(columnValue);
        assertEquals(now, columnValue);
    }
View Full Code Here

        java.sql.Date now = new java.sql.Date(cal.getTime().getTime());
        test.setDateColumn(now);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectDateTest");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Date columnValue = (Date) testRead.get("DATE_COLUMN");
        assertNotNull(columnValue);
        assertEquals(now.toString(), new java.sql.Date(columnValue.getTime()).toString());
    }
View Full Code Here

        Time now = new Time(cal.getTime().getTime());
        test.setTimeColumn(now);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectDateTest");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Date columnValue = (Date) testRead.get("TIME_COLUMN");
        assertNotNull(columnValue);
        assertEquals(now.toString(), new Time(columnValue.getTime()).toString());
    }
View Full Code Here

    }

    public void testNamedQuery() throws Exception {
        createTwoMtTable1sAnd2sDataSet();

        NamedQuery q = new NamedQuery("AllMtTable1");
        List<?> results = context.performQuery(q);

        assertEquals(2, results.size());
        assertTrue(results.get(0) instanceof ClientMtTable1);
    }
View Full Code Here

        Long bigintValue = 5326457654783454355l;
        test.setBigintColumn(bigintValue);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Object columnValue = testRead.get(columnName);
        assertNotNull(columnValue);
        assertEquals(Long.class, columnValue.getClass());
        assertEquals(bigintValue, columnValue);
View Full Code Here

                3, 4, 5, -6, 7, 0, 2, 9, 45, 64, 3, 127, -128, -60
        };
        test.setBinaryColumn(binaryValue);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectReturnTypesMap2");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Object columnValue = testRead.get(columnName);
        assertNotNull(columnValue);
        assertEquals(byte[].class, columnValue.getClass());
        assertTrue(Arrays.equals(binaryValue, (byte[]) columnValue));
View Full Code Here

        Boolean bitValue = true;
        test.setBitColumn(bitValue);
        context.commitChanges();

        NamedQuery q = new NamedQuery("SelectReturnTypesMap1");
        DataRow testRead = (DataRow) context.performQuery(q).get(0);
        Object columnValue = testRead.get(columnName);
        assertNotNull(columnValue);
        assertTrue(Boolean.class.equals(columnValue.getClass())
                || Short.class.equals(columnValue.getClass()));
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.NamedQuery

Copyright © 2018 www.massapicom. 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.