コード例 #1
0
  private void registerSecondaryNode(boolean many, OrmQueryProperties props) {

    String path = props.getPath();
    int lazyJoinBatch = props.getLazyFetchBatch();
    int batchSize = lazyJoinBatch > 0 ? lazyJoinBatch : defaultBatchSize;

    if (many) {
      DLoadManyContext manyContext = createManyContext(path, batchSize, props);
      manyMap.put(path, manyContext);
    } else {
      DLoadBeanContext beanContext = createBeanContext(path, batchSize, props);
      beanMap.put(path, beanContext);
    }
  }
コード例 #2
0
  /** Execute all the secondary queries. */
  public void executeSecondaryQueries(OrmQueryRequest<?> parentRequest, int defaultQueryBatch) {

    if (secQuery != null) {
      for (int i = 0; i < secQuery.size(); i++) {
        OrmQueryProperties properties = secQuery.get(i);

        int batchSize = properties.getQueryFetchBatch();
        if (batchSize == 0) {
          batchSize = defaultQueryBatch;
        }
        LoadSecondaryQuery load = getLoadSecondaryQuery(properties.getPath());
        load.loadSecondaryQuery(parentRequest, batchSize, properties.isQueryFetchAll());
      }
    }
  }
コード例 #3
0
  /**
   * Setup the load context at this path with OrmQueryProperties which is used to build the
   * appropriate query for +query or +lazy loading.
   */
  private void registerSecondaryQuery(OrmQueryProperties props) {

    String propName = props.getPath();
    ElPropertyValue elGetValue = rootDescriptor.getElGetValue(propName);

    boolean many = elGetValue.getBeanProperty().containsMany();
    registerSecondaryNode(many, props);
  }
コード例 #4
0
  /** This combines the sql from named/positioned parameters and expressions. */
  private void prepare(boolean buildSql, boolean parseRaw, DeployParser deployParser) {

    buildBindWhereRawSql(buildSql, parseRaw, deployParser);
    buildBindHavingRawSql(buildSql, parseRaw, deployParser);

    SpiExpressionList<?> whereExp = query.getWhereExpressions();
    if (whereExp != null) {
      DefaultExpressionRequest whereReq = new DefaultExpressionRequest(request, deployParser);
      whereExprBindValues = whereExp.buildBindValues(whereReq);
      if (buildSql) {
        whereExprSql = whereExp.buildSql(whereReq);
      }
    }

    BeanPropertyAssocMany<?> manyProperty = request.getManyProperty();
    if (manyProperty != null) {
      OrmQueryProperties chunk = query.getDetail().getChunk(manyProperty.getName(), false);
      SpiExpressionList<?> filterMany = chunk.getFilterMany();
      if (filterMany != null) {
        DefaultExpressionRequest filterReq = new DefaultExpressionRequest(request, deployParser);
        filterManyExprBindValues = filterMany.buildBindValues(filterReq);
        if (buildSql) {
          filterManyExprSql = filterMany.buildSql(filterReq);
        }
      }
    }

    // having expression
    SpiExpressionList<?> havingExpr = query.getHavingExpressions();
    if (havingExpr != null) {
      DefaultExpressionRequest havingReq = new DefaultExpressionRequest(request, deployParser);
      havingExprBindValues = havingExpr.buildBindValues(havingReq);
      if (buildSql) {
        havingExprSql = havingExpr.buildSql(havingReq);
      }
    }

    if (buildSql) {
      parsePropertiesToDbColumns(deployParser);
    }
  }