Package com.avaje.ebeaninternal.server.deploy

Examples of com.avaje.ebeaninternal.server.deploy.DRawSqlSelect


    } else {
      this.name = namedQuery.getName();
      this.sqlSelect = namedQuery.isSqlSelect();
      if (sqlSelect) {
        // potentially with where and having clause...
        DRawSqlSelect sqlSelect = namedQuery.getSqlSelect();
        additionalWhere = sqlSelect.getWhereClause();
        additionalHaving = sqlSelect.getHavingClause();
      } else if (namedQuery.isRawSql()) {
        rawSql = namedQuery.getRawSql();

      } else {
        // parse the entire query...
View Full Code Here


        SpiQuery<T> query = request.getQuery();
        BeanDescriptor<T> desc = request.getBeanDescriptor();

        DeployNamedQuery namedQuery = desc.getNamedQuery(query.getName());
        DRawSqlSelect sqlSelect = namedQuery.getSqlSelect();

        // create a parser for this specific SqlSelect... has to be really
        // as each SqlSelect could have different table alias etc
        DeployParser parser = sqlSelect.createDeployPropertyParser();

        CQueryPredicates predicates = new CQueryPredicates(binder, request);
        // prepare and convert logical property names to dbColumns etc
        predicates.prepareRawSql(parser);

        SqlTreeAlias alias = new SqlTreeAlias(sqlSelect.getTableAlias());
        predicates.parseTableAlias(alias);

        String sql = null;
        try {

            boolean includeRowNumColumn = false;
            String orderBy = sqlSelect.getOrderBy(predicates);

            // build the actual sql String
            sql = sqlSelect.buildSql(orderBy, predicates, request);
            if (query.hasMaxRowsOrFirstRow() && dbQueryLimiter != null) {
                // wrap with a limit offset or ROW_NUMBER() etc
                SqlLimitResponse limitSql = dbQueryLimiter.limit(new OrmQueryLimitRequest(sql, orderBy, query, dbPlatform));
                includeRowNumColumn = limitSql.isIncludesRowNumberColumn();

                sql = limitSql.getSql();
            } else {
                // add back select keyword
                // ... was removed to support dbQueryLimiter
                sql = "select " + sql;
            }

            SqlTree sqlTree = sqlSelect.getSqlTree();

            CQueryPlan queryPlan = new CQueryPlan(request, sql, sqlTree, true, includeRowNumColumn, "");
            CQuery<T> compiledQuery = new CQuery<T>(request, predicates, queryPlan);

            return compiledQuery;
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.deploy.DRawSqlSelect

Copyright © 2018 www.massapicom. 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.