Examples of JoinExpression


Examples of com.mysema.query.JoinExpression

    }
  }

  private void serializeSources(boolean forCountRow, List<JoinExpression> joins) {
    for (int i = 0; i < joins.size(); i++) {
      JoinExpression je = joins.get(i);
      if (i > 0) {
        append(joinTypes.get(je.getType()));
      }
      if (je.hasFlag(JPQLQueryMixin.FETCH) && !forCountRow) {
        handle(JPQLQueryMixin.FETCH);
      }
      handleJoinTarget(je);
      // XXX Hibernate specific flag
      if (je.hasFlag(JPQLQueryMixin.FETCH_ALL_PROPERTIES) && !forCountRow) {
        handle(JPQLQueryMixin.FETCH_ALL_PROPERTIES);
      }

      if (je.getCondition() != null) {
        append(templates.isWithForOn() ? WITH : ON);
        handle(je.getCondition());
      }
    }
  }
View Full Code Here

Examples of com.mysema.query.JoinExpression

    }

    private void serializeVariables(List<JoinExpression> joins) {
        append(VARIABLES);
        for (int i = 1; i < joins.size(); i++) {
            final JoinExpression je = joins.get(i);
            if (i > 1) {
                append("; ");
            }

            // type specifier
            if (je.getTarget() instanceof EntityPath) {
                final EntityPath<?> pe = (EntityPath<?>) je.getTarget();
                if (pe.getMetadata().getParent() == null) {
                    append(pe.getType().getName()).append(" ");
                }
            }
            handle(je.getTarget());
        }
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

     * @return
     */
    @SuppressWarnings("unchecked")
    private List<Expression<?>> getIdentifierColumns(List<JoinExpression> joins, boolean alias) {
        if (joins.size() == 1) {
            JoinExpression join = joins.get(0);
            if (join.getTarget() instanceof RelationalPath) {
                return ((RelationalPath)join.getTarget()).getColumns();
            } else {
                return Collections.emptyList();
            }

        } else {
            List<Expression<?>> rv = Lists.newArrayList();
            int counter = 0;
            for (JoinExpression join : joins) {
                if (join.getTarget() instanceof RelationalPath) {
                    RelationalPath path = (RelationalPath)join.getTarget();
                    List<Expression<?>> columns;
                    if (path.getPrimaryKey() != null) {
                        columns = path.getPrimaryKey().getLocalColumns();
                    } else {
                        columns = path.getColumns();
View Full Code Here

Examples of com.mysema.query.JoinExpression

                append(dummyTable);
            }
        } else {
            append(templates.getFrom());
            for (int i = 0; i < joins.size(); i++) {
                final JoinExpression je = joins.get(i);
                if (je.getFlags().isEmpty()) {
                    if (i > 0) {
                        append(templates.getJoinSymbol(je.getType()));
                    }
                    handleJoinTarget(je);
                    if (je.getCondition() != null) {
                        append(templates.getOn()).handle(je.getCondition());
                    }
                } else {
                    serialize(JoinFlag.Position.START, je.getFlags());
                    if (!serialize(JoinFlag.Position.OVERRIDE, je.getFlags()) && i > 0) {
                        append(templates.getJoinSymbol(je.getType()));
                    }
                    serialize(JoinFlag.Position.BEFORE_TARGET, je.getFlags());
                    handleJoinTarget(je);
                    serialize(JoinFlag.Position.BEFORE_CONDITION, je.getFlags());
                    if (je.getCondition() != null) {
                        append(templates.getOn()).handle(je.getCondition());
                    }
                    serialize(JoinFlag.Position.END, je.getFlags());
                }
            }
        }
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.from(cat);
        mixin.orderBy(cat.mate.name.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(
                new JoinExpression(JoinType.DEFAULT, cat),
                new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(cat_mate))),
                md.getJoins());
        assertEquals(Arrays.asList(cat_mate.name.asc()),
                md.getOrderBy());
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.from(cat);
        mixin.where(cat.mate.name.isNotNull());
        mixin.orderBy(cat.mate.name.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat)), md.getJoins());
        assertEquals(Arrays.asList(cat.mate.name.asc()), md.getOrderBy());
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.from(cat);
        mixin.groupBy(cat.mate.name);
        mixin.orderBy(cat.mate.name.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(new JoinExpression(JoinType.DEFAULT, cat)), md.getJoins());
        assertEquals(Arrays.asList(cat.mate.name.asc()), md.getOrderBy());
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.from(cat);
        mixin.orderBy(cat.mate.name.lower().asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(
                        new JoinExpression(JoinType.DEFAULT, cat),
                        new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(cat_mate))),
                md.getJoins());
        assertEquals(Arrays.asList(cat_mate.name.lower().asc()),
                md.getOrderBy());
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.from(cat);
        mixin.orderBy(cat.mate.mate.name.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(
                new JoinExpression(JoinType.DEFAULT, cat),
                new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(cat_mate)),
                new JoinExpression(JoinType.LEFTJOIN, cat_mate.mate.as(cat_mate_mate))),
                md.getJoins());
        assertEquals(Arrays.asList(cat_mate_mate.name.asc()),
                md.getOrderBy());
    }
View Full Code Here

Examples of com.mysema.query.JoinExpression

        mixin.leftJoin(cat.mate, mate);
        mixin.orderBy(cat.mate.name.asc());

        QueryMetadata md = mixin.getMetadata();
        assertEquals(Arrays.asList(
                new JoinExpression(JoinType.DEFAULT, cat),
                new JoinExpression(JoinType.LEFTJOIN, cat.mate.as(mate))),
                md.getJoins());
        assertEquals(Arrays.asList(mate.name.asc()),
                md.getOrderBy());
    }
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.