Package org.apache.torque.criteria

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


                        + "Subselects are not supported by Mysql < 4.1");
                return;
            }
        }
        Criteria subquery = new Criteria();
        subquery.addSelectColumn(
                new ColumnImpl("MAX(" + AuthorPeer.AUTHOR_ID + ")"));

        Criteria criteria = new Criteria();
        criteria.where(AuthorPeer.AUTHOR_ID, subquery);
View Full Code Here


     * @throws Exception if the test fails.
     */
    public void testDoSelectAll() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(stringColumnMap);
        criteria.addSelectColumn(integerColumnMap);
        // single result "fd", 23 found
        when(resultSet.next()).thenReturn(true, false);
        when(resultSet.getString(1)).thenReturn("fd");
        when(resultSet.getInt(2)).thenReturn(23);
View Full Code Here

     */
    public void testDoSelectAll() throws Exception
    {
        Criteria criteria = new Criteria();
        criteria.addSelectColumn(stringColumnMap);
        criteria.addSelectColumn(integerColumnMap);
        // single result "fd", 23 found
        when(resultSet.next()).thenReturn(true, false);
        when(resultSet.getString(1)).thenReturn("fd");
        when(resultSet.getInt(2)).thenReturn(23);

View Full Code Here

        {
            return;
        }

        Criteria subquery = new Criteria();
        subquery.addSelectColumn(AuthorPeer.AUTHOR_ID);
        List<String> authorIds = new ArrayList<String>();
        authorIds.add(author1.getName());
        authorIds.add(author2.getName());
        subquery.where(AuthorPeer.NAME, authorIds, Criteria.IN);
        Criteria criteria = new Criteria();
View Full Code Here

        {
            return;
        }

        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);
View Full Code Here

        {
            return;
        }

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

        List<Author> result = AuthorPeer.doSelect(criteria);
View Full Code Here

        {
            return;
        }

        Criteria subquery = new Criteria();
        subquery.addSelectColumn(AuthorPeer.AUTHOR_ID);
        List<String> nameList = new ArrayList<String>();
        nameList.add(author1.getName());
        nameList.add(author2.getName());
        subquery.where(AuthorPeer.NAME, nameList, Criteria.IN);
        Criteria criteria = new Criteria();
View Full Code Here

        {
            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

                NonPkOIntegerFkPeer.doSelectSingleRecord(
                criteria, new IntegerMapper()));
        for (NonPkOIntegerFk nonPkOIntegerFk : expected)
        {
            criteria = NonPkOIntegerFkPeer.buildCriteria(nonPkOIntegerFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + nonPkOIntegerFk,
                    new Integer(1),
                    NonPkOIntegerFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
View Full Code Here

                criteria, new IntegerMapper()));
        for (CompIntegerVarcharFk compIntegerVarcharFk : expected)
        {
            criteria = CompIntegerVarcharFkPeer.buildCriteria(
                    compIntegerVarcharFk);
            criteria.addSelectColumn(new Count("*"));
            Assert.assertEquals(
                    "Expected but not found : " + compIntegerVarcharFk,
                    new Integer(1),
                    CompIntegerVarcharFkPeer.doSelectSingleRecord(
                            criteria, new IntegerMapper()));
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.