Examples of PrefetchTreeNode


Examples of org.apache.cayenne.query.PrefetchTreeNode

            for (int i = 0; i < len; i++) {
                rowsColumn.add((DataRow) rows.get(i)[position]);
            }

            if (prefetchTree != null) {
                PrefetchTreeNode prefetchTreeNode = null;
                for (PrefetchTreeNode prefetch : prefetchTree.getChildren()) {
                    if (descriptor.getEntity().getName().equals(prefetch.getEntityName())) {
                        if (prefetchTreeNode == null) {
                            prefetchTreeNode = new PrefetchTreeNode();
                        }
                        PrefetchTreeNode addPath = prefetchTreeNode.addPath(prefetch
                                .getPath());
                        addPath.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
                        addPath.setPhantom(false);
                    }
                }
                prefetchTree = prefetchTreeNode;
            }
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            // a joint prefetch warrants full row compare

            final boolean[] compareFullRows = new boolean[1];

            final PrefetchTreeNode rootPrefetch = md.getPrefetchTree();

            if (rootPrefetch != null) {
                rootPrefetch.traverse(new PrefetchProcessor() {

                    public void finishPrefetch(PrefetchTreeNode node) {
                    }

                    public boolean startDisjointPrefetch(PrefetchTreeNode node) {
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

                        + "#result('DATE_OF_BIRTH' 'java.util.Date'), "
                        + "#result('t0.ARTIST_ID' 'int' '' 'ARTIST_ID') "
                        + "FROM ARTIST t0, PAINTING t1 "
                        + "WHERE t0.ARTIST_ID = t1.ARTIST_ID");

        PrefetchTreeNode prefetch = q.addPrefetch(Artist.PAINTING_ARRAY_PROPERTY);
        assertEquals(
                "Default semantics for SQLTemplate is assumed to be joint.",
                PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS,
                prefetch.getSemantics());
        q.setFetchingDataRows(false);

        final List<?> objects = context.performQuery(q);
       
        queryInterceptor.runWithQueriesBlocked(new UnitTestClosure() {
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            return super.visitSubselect(expression);
        }
       
        private void prepareFetchJoin(EJBQLJoin join) {
            if (prefetchTree == null) {
                prefetchTree = new PrefetchTreeNode();
            }
            EJBQLPath fetchJoin = (EJBQLPath) join.getChild(0);
            addPath(fetchJoin);

            PrefetchTreeNode node = prefetchTree.addPath(fetchJoin.getRelativePath());
            node.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
            node.setPhantom(false);
            node.setEjbqlPathEntityId(fetchJoin.getChild(0).getText());
        }
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

     */
    private void buildRowMapping() {
        final Map<String, ColumnDescriptor> targetSource = new TreeMap<String, ColumnDescriptor>();

        // build a DB path .. find parent node that terminates the joint group...
        PrefetchTreeNode jointRoot = this;
        while (jointRoot.getParent() != null && !jointRoot.isDisjointPrefetch()) {
            jointRoot = jointRoot.getParent();
        }

        final String prefix;
        if (jointRoot != this) {
            Expression objectPath = Expression.fromString(getPath(jointRoot));
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

        descriptor.visitProperties(new PropertyVisitor() {

            public boolean visitToOne(ToOneProperty property) {
                if (prefetchTree != null) {

                    PrefetchTreeNode child = prefetchTree.getNode(property.getName());

                    if (child != null) {
                        Object destinationSource = property.readProperty(source);

                        Object destinationTarget = destinationSource != null ? detach(
                                destinationSource,
                                property.getTargetDescriptor(),
                                child) : null;

                        ToOneProperty targetProperty = (ToOneProperty) targetDescriptor
                                .getProperty(property.getName());
                        Object oldTarget = targetProperty.isFault(target)
                                ? null
                                : targetProperty.readProperty(target);
                        targetProperty
                                .writeProperty(target, oldTarget, destinationTarget);
                    }
                }

                return true;
            }

            public boolean visitToMany(ToManyProperty property) {
                if (prefetchTree != null) {
                    PrefetchTreeNode child = prefetchTree.getNode(property.getName());

                    if (child != null) {
                        Object value = property.readProperty(source);
                        Object targetValue;
                       
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

        @Override
        void convert(List<DataRow> mainRows) {

            ClassDescriptor descriptor = metadata.getClassDescriptor();
            PrefetchTreeNode prefetchTree = metadata.getPrefetchTree();

            List<Persistent> objects = toObjects(descriptor, prefetchTree, mainRows);
            updateResponse(mainRows, objects);

            // apply POST_LOAD callback
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            for (int i = 0; i < len; i++) {
                rowsColumn.add((DataRow) rows.get(i)[position]);
            }
            List<Persistent> objects;
            if (prefetchTree != null) {
                PrefetchTreeNode prefetchTreeNode = null;
                for (PrefetchTreeNode prefetch : prefetchTree.getChildren()) {
                    if (descriptor.getEntity().getName().equals(prefetch.getEntityName())) {
                        if (prefetchTreeNode == null) {
                            prefetchTreeNode = new PrefetchTreeNode();
                        }
                        PrefetchTreeNode addPath = prefetchTreeNode.addPath(prefetch
                                .getPath());
                        addPath.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS);
                        addPath.setPhantom(false);
                    }
                }
                prefetchTree = prefetchTreeNode;
            }
            if (prefetchTree == null) {
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

            // a joint prefetch warrants full row compare

            final boolean[] compareFullRows = new boolean[1];

            final PrefetchTreeNode rootPrefetch = md.getPrefetchTree();

            if (rootPrefetch != null) {
                rootPrefetch.traverse(new PrefetchProcessor() {

                    public void finishPrefetch(PrefetchTreeNode node) {
                    }

                    public boolean startDisjointPrefetch(PrefetchTreeNode node) {
View Full Code Here

Examples of org.apache.cayenne.query.PrefetchTreeNode

       
        return false;
    }

    private void addPrefetchedColumnsIfAny(final String visitedIdentifier) {
        PrefetchTreeNode prefetchTree = context.getCompiledExpression().getPrefetchTree();
        if (prefetchTree != null) {
            for (PrefetchTreeNode prefetch : prefetchTree.adjacentJointNodes()) {
                ClassDescriptor descriptor = context.getEntityDescriptor(prefetch
                        .getEjbqlPathEntityId());
                if (visitedIdentifier.equals(prefetch.getEjbqlPathEntityId())) {
                    DbEntity table = descriptor.getRootDbEntities().iterator().next();
                    ObjEntity objectEntity = descriptor.getEntity();
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.