/** * INTERNAL: * Prepare the query from the prepared query. * This allows a dynamic query to prepare itself directly from a prepared query instance. * This is used in the EJBQL parse cache to allow preparsed queries to be used to prepare * dynamic queries. * This only copies over properties that are configured through EJBQL. */ public void prepareFromQuery(DatabaseQuery query) { super.prepareFromQuery(query); if (query.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)query; this.names = reportQuery.names; this.items = reportQuery.items; this.groupByExpressions = reportQuery.groupByExpressions; this.havingExpression = reportQuery.havingExpression; this.returnChoice = reportQuery.returnChoice; this.returnedKeys = reportQuery.returnedKeys; this.shouldRetrievePrimaryKeys = reportQuery.shouldRetrievePrimaryKeys; } }
/** * INTERNAL: * Prepare the query from the prepared query. * This allows a dynamic query to prepare itself directly from a prepared query instance. * This is used in the EJBQL parse cache to allow preparsed queries to be used to prepare * dynamic queries. * This only copies over properties that are configured through EJBQL. */ @Override public void prepareFromQuery(DatabaseQuery query) { super.prepareFromQuery(query); if (query.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)query; this.names = reportQuery.names; this.items = reportQuery.items; this.groupByExpressions = reportQuery.groupByExpressions; this.havingExpression = reportQuery.havingExpression; this.returnChoice = reportQuery.returnChoice; this.returnedKeys = reportQuery.returnedKeys; this.shouldRetrievePrimaryKeys = reportQuery.shouldRetrievePrimaryKeys; } }
/** * INTERNAL: * Prepare the query from the prepared query. * This allows a dynamic query to prepare itself directly from a prepared query instance. * This is used in the EJBQL parse cache to allow preparsed queries to be used to prepare * dynamic queries. * This only copies over properties that are configured through EJBQL. */ @Override public void prepareFromQuery(DatabaseQuery query) { super.prepareFromQuery(query); if (query.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)query; this.names = reportQuery.names; this.items = reportQuery.items; this.groupByExpressions = reportQuery.groupByExpressions; this.havingExpression = reportQuery.havingExpression; this.returnChoice = reportQuery.returnChoice; this.returnedKeys = reportQuery.returnedKeys; this.shouldRetrievePrimaryKeys = reportQuery.shouldRetrievePrimaryKeys; } }
/** * Access the internal EclipseLink query wrapped within the JPA query. A * EclipseLink JPA created from JP QL contains a ReportQuery if multiple * items or a non-entity type is being returned. This method will fail * if a single entity type is being returned as the query is a ReadAllQuery. * * @see JpaHelper#getReadAllQuery */ public static ReportQuery getReportQuery(Query query) { DatabaseQuery dbQuery = getDatabaseQuery(query); if (dbQuery.isReportQuery()) { return (ReportQuery)dbQuery; } throw new IllegalArgumentException(ExceptionLocalization.buildMessage("jpa_helper_invalid_report_query" + query.getClass())); }
/** * Determine if the JPA query is a EclipseLink ReportQuery. Useful for * frameworks that want to determine which get_X_Query method they can * safely invoke. */ public static boolean isReportQuery(Query query) { return isEclipseLink(query) && getDatabaseQuery(query).isReportQuery(); }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }
/** * Prepare and validate. * Allow subclasses to override. */ public void prepare(DatabaseQuery query, AbstractSession session) throws QueryException { if (query.isReadAllQuery() && (!query.isReportQuery()) && query.shouldUseWrapperPolicy()) { setElementDescriptor(query.getDescriptor()); //make sure DataReadQuery points to this container policy } else if (query.isDataReadQuery()) { ((DataReadQuery)query).setContainerPolicy(this); } }
returnQuery = new Query(query.getName(), jpql, new LinkTemplate("execute", method, context.getBaseURI() + context.getName() + "/query/" + query.getName() + parameterString)); if (query.isReportQuery()) { query.checkPrepare((AbstractSession) context.getServerSession(), new DatabaseRecord()); for (ReportItem item : ((ReportQuery) query).getItems()) {
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isObjectLevelReadQuery() && !query.isReportQuery()) { ObjectLevelReadQuery objectQuery = (ObjectLevelReadQuery)query; StringTokenizer tokenizer = new StringTokenizer((String)valueToApply, ".");
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isDataReadQuery()) { if (valueToApply == ResultType.Map) { ((DataReadQuery)query).setResultType(DataReadQuery.MAP); } else if (valueToApply == ResultType.Array) { ((DataReadQuery)query).setResultType(DataReadQuery.ARRAY); } else if (valueToApply == ResultType.Attribute) { ((DataReadQuery)query).setResultType(DataReadQuery.ATTRIBUTE); } else if (valueToApply == ResultType.Value) { ((DataReadQuery)query).setResultType(DataReadQuery.VALUE); } } else if (query.isReportQuery()) { if (valueToApply == ResultType.Map) { ((ReportQuery)query).setReturnType(ReportQuery.ShouldReturnReportResult); } else if (valueToApply == ResultType.Array) { ((ReportQuery)query).setReturnType(ReportQuery.ShouldReturnArray); } else if (valueToApply == ResultType.Attribute) { ((ReportQuery)query).setReturnType(ReportQuery.ShouldReturnSingleAttribute); } else if (valueToApply == ResultType.Value) { ((ReportQuery)query).setReturnType(ReportQuery.ShouldReturnSingleValue); } } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
/** * Pre-build the SQL statement from the expression. */ public void prepareCursorSelectAllRows() { if (getQuery().isReportQuery()) { SQLSelectStatement statement = buildReportQuerySelectStatement(false); setSQLStatement(statement); // For bug 2718118 inheritance with cursors is supported provided there is a read all subclasses view. } else if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().requiresMultipleTableSubclassRead() && getDescriptor().getInheritancePolicy().hasView()) { InheritancePolicy inheritancePolicy = getDescriptor().getInheritancePolicy(); SQLSelectStatement statement = inheritancePolicy.buildViewSelectStatement((ObjectLevelReadQuery)getQuery()); setSQLStatement(statement); } else { setSQLStatement(buildNormalSelectStatement()); } super.prepareCursorSelectAllRows(); }
/** * Pre-build the SQL statement from the expression. */ public void prepareCursorSelectAllRows() { if (getQuery().isReportQuery()) { SQLSelectStatement statement = buildReportQuerySelectStatement(false); setSQLStatement(statement); // For bug 2718118 inheritance with cursors is supported provided there is a read all subclasses view. } else if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().requiresMultipleTableSubclassRead() && getDescriptor().getInheritancePolicy().hasView()) { InheritancePolicy inheritancePolicy = getDescriptor().getInheritancePolicy(); SQLSelectStatement statement = inheritancePolicy.buildViewSelectStatement((ObjectLevelReadQuery)getQuery()); setSQLStatement(statement); } else { setSQLStatement(buildNormalSelectStatement()); } super.prepareCursorSelectAllRows(); }
/** * Pre-build the SQL statement from the expression. */ public void prepareCursorSelectAllRows() { if (getQuery().isReportQuery()) { SQLSelectStatement statement = buildReportQuerySelectStatement(false); setSQLStatement(statement); // For bug 2718118 inheritance with cursors is supported provided there is a read all subclasses view. } else if (getDescriptor().hasInheritance() && getDescriptor().getInheritancePolicy().requiresMultipleTableSubclassRead() && getDescriptor().getInheritancePolicy().hasView()) { InheritancePolicy inheritancePolicy = getDescriptor().getInheritancePolicy(); SQLSelectStatement statement = inheritancePolicy.buildViewSelectStatement((ObjectLevelReadQuery)getQuery()); setSQLStatement(statement); } else { setSQLStatement(buildNormalSelectStatement()); } super.prepareCursorSelectAllRows(); }
/** * Pre-build configure the SQL call. */ public void prepareCursorSelectAllRows() throws QueryException { getCall().returnCursor(); ContainerPolicy cp; DatabaseQuery query = getQuery(); if (query.isReadAllQuery()) { cp = ((ReadAllQuery)query).getContainerPolicy(); } else { cp = ((DataReadQuery)query).getContainerPolicy(); } if (cp.isScrollableCursorPolicy()) { ScrollableCursorPolicy scp = (ScrollableCursorPolicy)cp; DatabaseCall call = getDatabaseCall(); call.setIsResultSetScrollable(true); call.setResultSetType(scp.getResultSetType()); call.setResultSetConcurrency(scp.getResultSetConcurrency()); // Only set the fetch size to be the page size, if the fetch size was not set on the query. if (((ReadQuery)getQuery()).getFetchSize() == 0) { call.setResultSetFetchSize(scp.getPageSize()); } } if (getQuery().isReportQuery()){ prepareReportQueryItems(); } prepareCall(); }
/** * Pre-build configure the SQL call. */ public void prepareCursorSelectAllRows() throws QueryException { getCall().returnCursor(); ContainerPolicy cp; DatabaseQuery query = getQuery(); if (query.isReadAllQuery()) { cp = ((ReadAllQuery)query).getContainerPolicy(); } else { cp = ((DataReadQuery)query).getContainerPolicy(); } if (cp.isScrollableCursorPolicy()) { ScrollableCursorPolicy scp = (ScrollableCursorPolicy)cp; DatabaseCall call = getDatabaseCall(); call.setIsResultSetScrollable(true); call.setResultSetType(scp.getResultSetType()); call.setResultSetConcurrency(scp.getResultSetConcurrency()); // Only set the fetch size to be the page size, if the fetch size was not set on the query. if (((ReadQuery)getQuery()).getFetchSize() == 0) { call.setResultSetFetchSize(scp.getPageSize()); } } if (getQuery().isReportQuery()){ prepareReportQueryItems(); } prepareCall(); }
/** * Pre-build configure the SQL call. */ public void prepareCursorSelectAllRows() throws QueryException { getCall().returnCursor(); ContainerPolicy cp; DatabaseQuery query = getQuery(); if (query.isReadAllQuery()) { cp = ((ReadAllQuery)query).getContainerPolicy(); } else { cp = ((DataReadQuery)query).getContainerPolicy(); } if (cp.isScrollableCursorPolicy()) { ScrollableCursorPolicy scp = (ScrollableCursorPolicy)cp; DatabaseCall call = getDatabaseCall(); call.setIsResultSetScrollable(true); call.setResultSetType(scp.getResultSetType()); call.setResultSetConcurrency(scp.getResultSetConcurrency()); // Only set the fetch size to be the page size, if the fetch size was not set on the query. if (((ReadQuery)getQuery()).getFetchSize() == 0) { call.setResultSetFetchSize(scp.getPageSize()); } } if (getQuery().isReportQuery()){ prepareReportQueryItems(); } prepareCall(); }
boolean objectLevelRead = (query.isObjectLevelReadQuery() && !query.isReportQuery() && query.shouldMaintainCache()); if (objectLevelRead) { ObjectLevelReadQuery readQuery = (ObjectLevelReadQuery)query;
boolean objectLevelRead = (query.isObjectLevelReadQuery() && !query.isReportQuery() && query.shouldMaintainCache()); if (objectLevelRead) { ObjectLevelReadQuery readQuery = (ObjectLevelReadQuery)query;
boolean objectLevelRead = (query.isObjectLevelReadQuery() && !query.isReportQuery() && query.shouldMaintainCache()); if (objectLevelRead) { ObjectLevelReadQuery readQuery = (ObjectLevelReadQuery)query;