@SuppressWarnings({ "unchecked" }) private void renderFetches( StringBuilder jpaqlQuery, RenderingContext renderingContext, Collection<Fetch> fetches) { if ( fetches == null ) { return; } for ( Fetch fetch : fetches ) { ( (FromImplementor) fetch ).prepareAlias( renderingContext ); jpaqlQuery.append( renderJoinType( fetch.getJoinType() ) ) .append( "fetch " ) .append( ( (FromImplementor) fetch ).renderTableExpression( renderingContext ) ); renderFetches( jpaqlQuery, renderingContext, fetch.getFetches() ); } } }
/** * Return whether the given {@link From} contains a fetch declaration for the attribute with the given name. * * @param from the {@link From} to check for fetches. * @param attribute the attribute name to check. * @return */ private static boolean isAlreadyFetched(From<?, ?> from, String attribute) { for (Fetch<?, ?> fetch : from.getFetches()) { boolean sameName = fetch.getAttribute().getName().equals(attribute); if (sameName && fetch.getJoinType().equals(JoinType.LEFT)) { return true; } } return false; }
@Override public JoinType getJoinType() { return getWrapped().getJoinType(); }
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) { List<String> iPaths = new ArrayList<String>(); List<String> oPaths = new ArrayList<String>(); Set<Root<?>> roots = q.getRoots(); for (Root root : roots) { Set<Fetch> fetches = root.getFetches(); if (fetches == null) continue; for (Fetch<?,?> fetch : fetches) { String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false); oPaths.add(fPath); if (fetch.getJoinType() == JoinType.INNER) { iPaths.add(fPath); } } } if (!iPaths.isEmpty()) { exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]); } if (!oPaths.isEmpty()) { exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]); } }
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) { List<String> iPaths = new ArrayList<String>(); List<String> oPaths = new ArrayList<String>(); Set<Root<?>> roots = q.getRoots(); for (Root root : roots) { Set<Fetch> fetches = root.getFetches(); if (fetches == null) continue; for (Fetch<?,?> fetch : fetches) { String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false); oPaths.add(fPath); if (fetch.getJoinType() == JoinType.INNER) { iPaths.add(fPath); } } } if (!iPaths.isEmpty()) { exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]); } if (!oPaths.isEmpty()) { exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]); } }
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) { List<String> iPaths = new ArrayList<String>(); List<String> oPaths = new ArrayList<String>(); Set<Root<?>> roots = q.getRoots(); for (Root root : roots) { Set<Fetch> fetches = root.getFetches(); if (fetches == null) continue; for (Fetch<?,?> fetch : fetches) { String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false); oPaths.add(fPath); if (fetch.getJoinType() == JoinType.INNER) { iPaths.add(fPath); } } } if (!iPaths.isEmpty()) { exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]); } if (!oPaths.isEmpty()) { exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]); } }
protected void evalFetchJoin(QueryExpressions exps, ExpressionFactory factory, CriteriaQueryImpl<?> q) { List<String> iPaths = new ArrayList<String>(); List<String> oPaths = new ArrayList<String>(); Set<Root<?>> roots = q.getRoots(); for (Root root : roots) { Set<Fetch> fetches = root.getFetches(); if (fetches == null) continue; for (Fetch<?,?> fetch : fetches) { String fPath = ((Members.Member<?, ?>)fetch.getAttribute()).fmd.getFullName(false); oPaths.add(fPath); if (fetch.getJoinType() == JoinType.INNER) { iPaths.add(fPath); } } } if (!iPaths.isEmpty()) { exps.fetchInnerPaths = iPaths.toArray(new String[iPaths.size()]); } if (!oPaths.isEmpty()) { exps.fetchPaths = oPaths.toArray(new String[oPaths.size()]); } }
@SuppressWarnings({ "unchecked" }) private void renderFetches( StringBuilder jpaqlQuery, CriteriaQueryCompiler.RenderingContext renderingContext, Collection<Fetch> fetches) { if ( fetches == null ) { return; } for ( Fetch fetch : fetches ) { ( (FromImplementor) fetch ).prepareAlias( renderingContext ); jpaqlQuery.append( renderJoinType( fetch.getJoinType() ) ) .append( "fetch " ) .append( ( (FromImplementor) fetch ).renderTableExpression( renderingContext ) ); renderFetches( jpaqlQuery, renderingContext, fetch.getFetches() ); } } }
/** * Return whether the given {@link From} contains a fetch declaration for the attribute with the given name. * * @param from the {@link From} to check for fetches. * @param attribute the attribute name to check. * @return */ private static boolean isAlreadyFetched(From<?, ?> from, String attribute) { for (Fetch<?, ?> fetch : from.getFetches()) { boolean sameName = fetch.getAttribute().getName().equals(attribute); if (sameName && fetch.getJoinType().equals(JoinType.LEFT)) { return true; } } return false; }
if (join.getJoinType() == JoinType.LEFT) else if (join.getJoinType() == JoinType.RIGHT)