javax.persistence.criteria.Fetch.getJoinType()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中javax.persistence.criteria.Fetch.getJoinType()方法的一些代码示例,展示了Fetch.getJoinType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Fetch.getJoinType()方法的具体详情如下:
包路径:javax.persistence.criteria.Fetch
类名称:Fetch
方法名:getJoinType

Fetch.getJoinType介绍

[英]Return the join type used in the fetch join.
[中]返回获取联接中使用的联接类型。

代码示例

代码示例来源:origin: hibernate/hibernate-orm

@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() );
    }
  }
}

代码示例来源:origin: spring-projects/spring-data-jpa

/**
 * 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;
}

代码示例来源:origin: org.omnifaces/omnipersistence

@Override
public JoinType getJoinType() {
  return getWrapped().getJoinType();
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-persistence

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()]);
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa

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()]);
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-persistence

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()]);
  }
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

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()]);
  }
}

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.ejb

@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() );
    }
  }
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

/**
 * 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;
}

代码示例来源:origin: org.datanucleus/datanucleus-jpa

if (join.getJoinType() == JoinType.LEFT)
else if (join.getJoinType() == JoinType.RIGHT)

相关文章

微信公众号

最新文章

更多