Package org.apache.torque

Examples of org.apache.torque.ColumnImpl


        criteria.addJoin(
                BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID,
                Criteria.RIGHT_JOIN);
        criteria.addJoin(
                AuthorPeer.AUTHOR_ID,
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()),
                Criteria.LEFT_JOIN);
        List<Author> authorList = AuthorPeer.doSelect(criteria);
        // Here we get 11 authors:
        // the author with one book, the author without books,
        // and nine times the author with three books
View Full Code Here


        Criteria criteria = new Criteria();
        criteria.addAlias("b", BookPeer.TABLE_NAME);
        criteria.addJoin(BookPeer.AUTHOR_ID, AuthorPeer.AUTHOR_ID,
                Criteria.RIGHT_JOIN);
        criteria.addJoin(
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()),
                AuthorPeer.AUTHOR_ID,
                Criteria.RIGHT_JOIN);

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

        subselect.where(BookPeer.TITLE, "Book 1");

        Criteria criteria = new Criteria();
        criteria.addAlias("b", subselect);
        criteria.addJoin(
                new ColumnImpl("b." + BookPeer.AUTHOR_ID.getColumnName()),
                AuthorPeer.AUTHOR_ID);

        List<Author> authorList = AuthorPeer.doSelect(criteria);

        // Here we get the one author with ine book:
View Full Code Here

        Criteria criteria = new Criteria();
        criteria.addAlias("bc", BintBcharTypePeer.TABLE_NAME);
        criteria.addJoin(
                BintBcharTypePeer.ID,
                new ColumnImpl("bc.id"));
        criteria.where(new ColumnImpl("bc.BINT_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BCHAR_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BINT_OBJECT_VALUE"), new Boolean(false))
                .and(new ColumnImpl("bc.BCHAR_OBJECT_VALUE"), new Boolean(false));
        List<BintBcharType> selectedList
                = BintBcharTypePeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset with both values false "
                + "but read " + selectedList.size(),
                selectedList.size() == 1);
View Full Code Here

     */
    public void testCorrectBooleansInUnqualifiedColumns() throws Exception
    {
        // check whether booleans are replaced with unqualified columns
        Criteria criteria = new Criteria()
            .where(new ColumnImpl("BINT_VALUE"), true)
            .and(new ColumnImpl("BCHAR_VALUE"), true);

        BintBcharTypePeer.correctBooleans(criteria);

        Criterion criterionInt
                = criteria.getTopLevelCriterion().getParts().get(0);
View Full Code Here

            final Database database = Torque.getDatabase(dbName);
            resolvedSchemaName = database.getSchema();
        }
        if (sqlExpressionModified)
        {
            return new ColumnImpl(
                    resolvedSchemaName,
                    resolvedTableName,
                    resolvedColumn.getColumnName());
        }
        else
        {
            return new ColumnImpl(
                    resolvedSchemaName,
                    resolvedTableName,
                    resolvedColumn.getColumnName(),
                    resolvedColumn.getSqlExpression());
        }
View Full Code Here

        while (iMap.hasNext())
        {
            String key = (String) iMap.next();
            SQLFunction f = (SQLFunction) iMap.getValue();
            Column col =  f.getColumn();
            c.addAsColumn(key, new ColumnImpl(
                    null,
                    col.getTableName(),
                    col.getColumnName(),
                    f.getSqlExpression()));
            if (!haveFromTable)    // Last chance. Get it from the func.
View Full Code Here

        while (iMap.hasNext())
        {
            String key = (String) iMap.next();
            SQLFunction f = (SQLFunction) iMap.getValue();
            Column col =  f.getColumn();
            c.addAsColumn(key, new ColumnImpl(
                    null,
                    col.getTableName(),
                    col.getColumnName(),
                    f.getSqlExpression()));
            if (!haveFromTable)    // Last chance. Get it from the func.
View Full Code Here

     *
     * @param sqlExpression the SQL expression to calculate the maximum from.
     */
    public Max(String sqlExpression)
    {
        super("MAX", new ColumnImpl(sqlExpression), false);
    }
View Full Code Here

        {
            criteriaSelectModifiers.remove(SqlEnum.DISTINCT.toString());
            distinct = true;
        }

        c.addSelectColumn(new Count(new ColumnImpl(columnName), distinct));

        String databaseName = (c.getDbName() == null)
                ? Torque.getDefaultDB()
                : c.getDbName();
View Full Code Here

TOP

Related Classes of org.apache.torque.ColumnImpl

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.