Package org.apache.torque.criteria

Examples of org.apache.torque.criteria.FromElement


        // the joins are processed
        if (!fromClauseContainsExpression(
            queryFromClause,
            fromClauseExpression))
        {
            FromElement fromElement = new FromElement(
                    fromClauseExpression.getSql().toString(),
                    null,
                    null,
                    fromClauseExpression.getPreparedStatementReplacements());
            queryFromClause.add(fromElement);
View Full Code Here


        }

        boolean first = true;
        for (Iterator<FromElement> it = fromClause.iterator(); it.hasNext();)
        {
            FromElement fromElement = it.next();

            if (!first && fromElement.getJoinCondition() == null)
            {
                stringBuilder.append(", ");
            }
            first = false;
            stringBuilder.append(fromElement.toString());
        }

        if (Type.SELECT == type
                && (forUpdate != null)
                && !"FOR UPDATE".equals(forUpdate))
View Full Code Here

        columns.add("tableA.column2");
        columns.add("tableB.column1");

        UniqueList<FromElement> tables = query.getFromClause();
        tables.clear();
        tables.add(new FromElement("tableA"));
        tables.add(new FromElement("tableB"));

        UniqueList<String> where = query.getWhereClause();
        where.clear();
        where.add("tableA.A = tableB.A");
        where.add("tableA.B = 1234");
View Full Code Here

                break;
            }
        }
        if (!ownTableAdded)
        {
            query.getFromClause().add(new FromElement(fullTableName));
        }
        String sql = query.toString();

        PreparedStatement preparedStatement = null;
        try
View Full Code Here

                break;
            }
        }
        if (!ownTableAdded)
        {
            query.getFromClause().add(new FromElement(fullTableName));
        }
        String sql = query.toString();

        PreparedStatement preparedStatement = null;
        try
View Full Code Here

        if (query.getFromClause().isEmpty())
        {
            String tableName = SqlBuilder.getFullTableName(
                    getTableMap().getFullyQualifiedTableName(),
                    criteria.getDbName());
            query.getFromClause().add(new FromElement(tableName));
        }

        PreparedStatement statement = null;
        ResultSet resultSet = null;
        try
View Full Code Here

        if (query.getFromClause().isEmpty())
        {
            String tableName = SqlBuilder.getFullTableName(
                    getTableMap().getFullyQualifiedTableName(),
                    criteria.getDbName());
            query.getFromClause().add(new FromElement(tableName));
        }

        PreparedStatement statement = null;
        ResultSet resultSet = null;
        try
View Full Code Here

        query.getFromClause().clear();
        String fullTableName = SqlBuilder.getFullTableName(
                getTableMap().getFullyQualifiedTableName(),
                criteria.getDbName());
        query.getFromClause().add(new FromElement(fullTableName));

        List<JdbcTypedValue> replacementObjects
                = new ArrayList<JdbcTypedValue>();
        for (Map.Entry<Column, JdbcTypedValue> updateValue
                : updateValues.entrySet())
View Full Code Here

        query.getFromClause().clear();
        String fullTableName = SqlBuilder.getFullTableName(
                getTableMap().getFullyQualifiedTableName(),
                criteria.getDbName());
        query.getFromClause().add(new FromElement(fullTableName));

        List<JdbcTypedValue> replacementObjects
                = new ArrayList<JdbcTypedValue>();
        for (Map.Entry<Column, JdbcTypedValue> updateValue
                : updateValues.entrySet())
View Full Code Here

                {
                    if (!SqlBuilder.fromClauseContainsExpression(
                                queryFromClause,
                                leftExpression))
                    {
                        FromElement fromElement = new FromElement(
                            leftExpression.getSql().toString(),
                            null,
                            null,
                            leftExpression.getPreparedStatementReplacements());
                        queryFromClause.add(fromElement);
                    }

                    FromElement fromElement = new FromElement(
                            rightExpression.getSql().toString(),
                            joinType,
                            buildJoinCondition(joinCondition, criteria));
                    queryFromClause.add(fromElement);
                }
                else
                {
                    if (SqlBuilder.fromClauseContainsExpression(
                                queryFromClause,
                                leftExpression))
                    {
                        // We cannot add an explicit join if both tables
                        // are already present in the from clause
                        throw new TorqueException(
                                "Unable to create a" + joinType
                                + "because both expressions "
                                + leftExpression.getSql()
                                + " and " + rightExpression.getSql()
                                + " are already in use. "
                                + "Try to create an(other) alias.");
                    }
                    // now add the join in reverse order
                    // rightTableName must not be added
                    // because it is already present
                    FromElement fromElement = new FromElement(
                        leftExpression.getSql().toString(),
                        reverseJoinType(joinType),
                        buildJoinCondition(joinCondition, criteria));
                    queryFromClause.add(fromElement);
                }
View Full Code Here

TOP

Related Classes of org.apache.torque.criteria.FromElement

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.