Examples of DbJoin


Examples of org.apache.cayenne.map.DbJoin

            context.append(" ON (");

            List<DbJoin> joins = dbRelationship.getJoins();
            Iterator<DbJoin> it = joins.iterator();
            while (it.hasNext()) {
                DbJoin join = it.next();
                context.append(' ').append(subqueryTargetAlias).append('.').append(
                        join.getTargetName()).append(" = ");
                context.append(subquerySourceAlias).append('.').append(
                        join.getSourceName());
                if (it.hasNext()) {
                    context.append(" AND");
                }
            }
            context.append(" )");
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

                DbRelationship dbRel = rel.getDbRelationships().get(0);

                List<DbJoin> joins = dbRel.getJoins();
                int len = joins.size();
                for (int i = 0; i < len; i++) {
                    DbJoin join = joins.get(i);
                    DbAttribute src = join.getSource();
                    appendColumn(columns, null, src, attributes, null);
                }
            }
        };
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        DbRelationship correlatedJoinRelationship = context.getIncomingRelationships(
                new EJBQLTableId(id)).get(0);
        Iterator<DbJoin> it = correlatedJoinRelationship.getJoins().iterator();
        while (it.hasNext()) {
            DbJoin join = it.next();
            context.append(' ').append(subqueryRootAlias).append('.').append(
                    join.getTargetName()).append(" = ");
            context.append(correlatedTableAlias).append('.').append(join.getSourceName());

            if (it.hasNext()) {
                context.append(" AND");
            }
        }
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        // relation from new_table to artist
        DbRelationship r1 = new DbRelationship("toArtistR1");
        r1.setSourceEntity(dbEntity);
        r1.setTargetEntity(artistDbEntity);
        r1.setToMany(false);
        r1.addJoin(new DbJoin(r1, "ARTIST_ID", "ARTIST_ID"));
        dbEntity.addRelationship(r1);

        // relation from artist to new_table
        DbRelationship r2 = new DbRelationship("toNewTableR2");
        r2.setSourceEntity(artistDbEntity);
        r2.setTargetEntity(dbEntity);
        r2.setToMany(true);
        r2.addJoin(new DbJoin(r2, "ARTIST_ID", "ARTIST_ID"));
        artistDbEntity.addRelationship(r2);

        assertTokensAndExecute(node, map, 2, 0);
        assertTokensAndExecute(node, map, 0, 0);
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        // relation from new_table to artist
        DbRelationship r1 = new DbRelationship("toArtistR1");
        r1.setSourceEntity(dbEntity);
        r1.setTargetEntity(artistDbEntity);
        r1.setToMany(false);
        r1.addJoin(new DbJoin(r1, "ARTIST_ID", "ARTIST_ID"));
        dbEntity.addRelationship(r1);

        // relation from artist to new_table
        DbRelationship r2 = new DbRelationship("toNewTableR2");
        r2.setSourceEntity(artistDbEntity);
        r2.setTargetEntity(dbEntity);
        r2.setToMany(true);
        r2.addJoin(new DbJoin(r2, "ARTIST_ID", "ARTIST_ID"));
        artistDbEntity.addRelationship(r2);

        assertTokensAndExecute(node, map, 1, 0);
        assertTokensAndExecute(node, map, 0, 0);
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        // create db relationships
        DbRelationship rel1To2 = new DbRelationship("rel1To2");
        rel1To2.setSourceEntity(dbEntity1);
        rel1To2.setTargetEntity(dbEntity2);
        rel1To2.setToMany(true);
        rel1To2.addJoin(new DbJoin(rel1To2, e1col1.getName(), e2col2.getName()));
        dbEntity1.addRelationship(rel1To2);
        DbRelationship rel2To1 = new DbRelationship("rel2To1");
        rel2To1.setSourceEntity(dbEntity2);
        rel2To1.setTargetEntity(dbEntity1);
        rel2To1.setToMany(false);
        rel2To1.addJoin(new DbJoin(rel2To1, e2col2.getName(), e1col1.getName()));
        dbEntity2.addRelationship(rel2To1);
        assertSame(rel1To2, rel2To1.getReverseRelationship());
        assertSame(rel2To1, rel1To2.getReverseRelationship());

        assertTokensAndExecute(node, map, 4, 0);
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        // create db relationships, but do not sync them to db
        DbRelationship rel1To2 = new DbRelationship("rel1To2");
        rel1To2.setSourceEntity(dbEntity1);
        rel1To2.setTargetEntity(dbEntity2);
        rel1To2.setToMany(true);
        rel1To2.addJoin(new DbJoin(rel1To2, e1col1.getName(), e2col2.getName()));
        dbEntity1.addRelationship(rel1To2);
        DbRelationship rel2To1 = new DbRelationship("rel2To1");
        rel2To1.setSourceEntity(dbEntity2);
        rel2To1.setTargetEntity(dbEntity1);
        rel2To1.setToMany(false);
        rel2To1.addJoin(new DbJoin(rel2To1, e2col2.getName(), e1col1.getName()));
        dbEntity2.addRelationship(rel2To1);
        assertSame(rel1To2, rel2To1.getReverseRelationship());
        assertSame(rel2To1, rel1To2.getReverseRelationship());

        // create ObjEntities
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        Map<String, Object> snapshot = new HashMap<String, Object>(fromSourceJoins.size()
                + toTargetJoins.size(), 1);

        for (int i = 0, numJoins = fromSourceJoins.size(); i < numJoins; i++) {
            DbJoin join = fromSourceJoins.get(i);

            Object value = new PropagatedValueFactory(sourceId, join.getSourceName());
            snapshot.put(join.getTargetName(), value);
        }

        for (int i = 0, numJoins = toTargetJoins.size(); i < numJoins; i++) {
            DbJoin join = toTargetJoins.get(i);
            Object value = new PropagatedValueFactory(destinationId, join.getTargetName());
            snapshot.put(join.getSourceName(), value);
        }

        return snapshot;
    }
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

        Map<String, Object> snapshot = new HashMap<String, Object>(fromSourceJoins.size()
                + toTargetJoins.size(), 1);

        for (int i = 0, numJoins = fromSourceJoins.size(); i < numJoins; i++) {
            DbJoin join = fromSourceJoins.get(i);

            Object value = new PropagatedValueFactory(sourceId, join.getSourceName());
            snapshot.put(join.getTargetName(), value);
        }

        for (int i = 0, numJoins = toTargetJoins.size(); i < numJoins; i++) {
            DbJoin join = toTargetJoins.get(i);
            Object value = new PropagatedValueFactory(destinationId, join.getTargetName());
            snapshot.put(join.getSourceName(), value);
        }

        return snapshot;
    }
View Full Code Here

Examples of org.apache.cayenne.map.DbJoin

            String targetAlias = appendTable(rhsId);
            context.append(" ON (");

            Iterator<DbJoin> it = incomingDB.getJoins().iterator();
            if (it.hasNext()) {
                DbJoin dbJoin = it.next();
                context
                        .append(sourceAlias)
                        .append('.')
                        .append(dbJoin.getSourceName())
                        .append(" = ")
                        .append(targetAlias)
                        .append('.')
                        .append(dbJoin.getTargetName());
            }

            while (it.hasNext()) {
                context.append(", ");
                DbJoin dbJoin = it.next();
                context
                        .append(sourceAlias)
                        .append('.')
                        .append(dbJoin.getSourceName())
                        .append(" = ")
                        .append(targetAlias)
                        .append('.')
                        .append(dbJoin.getTargetName());
            }

            context.append(")");
        }
        finally {
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.