Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.Query


        }

        // create proxies for named queries
        Iterator queries = getQueries().iterator();
        while (queries.hasNext()) {
            Query q = (Query) queries.next();
            NamedQuery proxy = new NamedQuery(q.getName());
            proxy.setName(q.getName());

            // resolve metadata so that client can have access to it without knowing about
            // the server query.
            proxy.initMetadata(q.getMetaData(serverResolver));
            clientMap.addQuery(proxy);
        }

        return clientMap;
    }
View Full Code Here


            this.addObjEntity(ent);
        }

        Iterator queries = new ArrayList(map.getQueries()).iterator();
        while (queries.hasNext()) {
            Query query = (Query) queries.next();
            this.removeQuery(query.getName());
            this.addQuery(query);
        }
    }
View Full Code Here

     * Returns a named query associated with this DataMap.
     *
     * @since 1.1
     */
    public Query getQuery(String queryName) {
        Query query = (Query) queryMap.get(queryName);
        if (query != null) {
            return query;
        }

        return namespace != null ? namespace.getQuery(queryName) : null;
View Full Code Here

        List finalQueries = new ArrayList(queries.size());

        Iterator it = queries.iterator();
        while (it.hasNext()) {
            Query query = (Query) it.next();

            query = filterThroughDelegateDeprecated(query);

            if (query != null) {
                finalQueries.add(query);
View Full Code Here

            }

            // index queries
            Iterator queries = map.getQueries().iterator();
            while (queries.hasNext()) {
                Query query = (Query) queries.next();
                String name = query.getName();
                Object existingQuery = queryCache.put(name, query);

                if (existingQuery != null && query != existingQuery) {
                    throw new CayenneRuntimeException("More than one Query for name"
                            + name);
View Full Code Here

    /**
     * Returns a named query or null if no query exists for a given name.
     */
    public synchronized Query lookupQuery(String name) {
        Query result = (Query) queryCache.get(name);

        if (result == null) {
            // reconstruct cache just in case some of the datamaps
            // have changed and now contain the required information
            constructCache();
View Full Code Here

            logObj.debug("no cached snapshot for ObjectId: " + oid);
        }

        // try getting it from database

        Query query = new ObjectIdQuery(oid, true, ObjectIdQuery.CACHE_REFRESH);
        List results = channel.onQuery(null, query).firstList();

        if (results.size() > 1) {
            throw new CayenneRuntimeException("More than 1 object found for ObjectId "
                    + oid
View Full Code Here

    public boolean isIteratedResult() {
        return callback.isIteratedResult();
    }

    Query queryForExecutedQuery(Query executedQuery) {
        Query q = null;

        if (queriesByExecutedQueries != null) {
            q = (Query) queriesByExecutedQueries.get(executedQuery);
        }
View Full Code Here

    /** Translates query Ordering list to SQL ORDER BY clause.
     *  Ordering list is obtained from <code>queryAssembler</code>'s query object.
     *  In a process of building of ORDER BY clause, <code>queryAssembler</code>
     *  is notified when a join needs to be added. */
    public String doTranslation() {
        Query q = queryAssembler.getQuery();

        // only select queries can have ordering...
        if (q == null || !(q instanceof SelectQuery))
            return null;

View Full Code Here

        try {
            DataNodeQueryAction queryRunner = new DataNodeQueryAction(this, callback);
            Iterator it = queries.iterator();
            while (it.hasNext()) {
                Query nextQuery = (Query) it.next();

                // catch exceptions for each individual query
                try {
                    queryRunner.runQuery(connection, nextQuery);
                }
View Full Code Here

TOP

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

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.