/** * INTERNAL: * Get the container policy from the selection query for this mapping. */ @Override protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((DataReadQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * Get the container policy from the selection query for this mapping. */ @Override protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((DataReadQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * Get the container policy from the selection query for this mapping. */ protected ContainerPolicy getSelectionQueryContainerPolicy() { return ((DataReadQuery) getSelectionQuery()).getContainerPolicy(); }
/** * INTERNAL: * Used by RemoteSession. */ @Override public Object remoteExecute() { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().remoteExecute(); } return super.remoteExecute(); }
/** * INTERNAL: * Execute the query. * Perform the work to execute the SQL string. * @exception DatabaseException an error has occurred on the database * @return a collection or cursor of Records representing the result set */ public Object executeDatabaseQuery() throws DatabaseException { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().execute(); } return executeNonCursor(); }
/** * INTERNAL: * Used by RemoteSession. */ @Override public Object remoteExecute() { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().remoteExecute(); } return super.remoteExecute(); }
/** * INTERNAL: */ public Object remoteExecute() { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().remoteExecute(); } return super.remoteExecute(); }
/** * INTERNAL: * Execute the query. * Perform the work to execute the SQL string. * @exception DatabaseException an error has occurred on the database * @return a collection or cursor of Records representing the result set */ @Override public Object executeDatabaseQuery() throws DatabaseException { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().execute(); } return executeNonCursor(); }
/** * INTERNAL: * Execute the query. * Perform the work to execute the SQL string. * @exception DatabaseException an error has occurred on the database * @return a collection or cursor of Records representing the result set */ @Override public Object executeDatabaseQuery() throws DatabaseException { if (getContainerPolicy().overridesRead()) { return getContainerPolicy().execute(); } return executeNonCursor(); }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ public void prepareForExecution() throws QueryException { super.prepareForExecution(); getContainerPolicy().prepareForExecution(); }
/** * INTERNAL: * Prepare the receiver for execution in a session. */ protected void prepare() { super.prepare(); getContainerPolicy().prepare(this, getSession()); if (getContainerPolicy().overridesRead()) { return; } getQueryMechanism().prepareExecuteSelect(); }
/** * INTERNAL: * Clone the query. */ public Object clone() { DataReadQuery cloneQuery = (DataReadQuery)super.clone(); cloneQuery.setContainerPolicy(getContainerPolicy().clone(cloneQuery)); return cloneQuery; }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((ReadAllQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((ReadAllQuery) query).getContainerPolicy()).setInitialReadSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_INITIAL_SIZE)); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((DataReadQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((DataReadQuery) query).getContainerPolicy()).setInitialReadSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_INITIAL_SIZE)); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { int value = (Integer)valueToApply; if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isScrollableCursorPolicy()) { ((ReadAllQuery) query).useScrollableCursor(); } ((ScrollableCursorPolicy)((ReadAllQuery) query).getContainerPolicy()).setResultSetType(value); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isScrollableCursorPolicy()) { ((DataReadQuery) query).useScrollableCursor(); } ((ScrollableCursorPolicy)((DataReadQuery) query).getContainerPolicy()).setResultSetType(value); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { int value = (Integer)valueToApply; if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isScrollableCursorPolicy()) { ((ReadAllQuery) query).useScrollableCursor(); } ((ScrollableCursorPolicy)((ReadAllQuery) query).getContainerPolicy()).setResultSetConcurrency(value); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isScrollableCursorPolicy()) { ((DataReadQuery) query).useScrollableCursor(); } ((ScrollableCursorPolicy)((DataReadQuery) query).getContainerPolicy()).setResultSetConcurrency(value); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isCursorPolicy()) { ((ReadAllQuery) query).useCursoredStream(); } ((CursorPolicy)((ReadAllQuery) query).getContainerPolicy()).setPageSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_PAGE_SIZE)); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isCursorPolicy()) { ((DataReadQuery) query).useCursoredStream(); } ((CursorPolicy)((DataReadQuery) query).getContainerPolicy()).setPageSize(QueryHintsHandler.parseIntegerHint(valueToApply, QueryHints.CURSOR_PAGE_SIZE)); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
/** * INTERNAL: * Execute the query. If there are cached results return those. * This must override the super to support result caching. * * @param aSession - the session in which the receiver will be executed. * @return An object or vector, the result of executing the query. * @exception DatabaseException - an error has occurred on the database */ public Object execute(AbstractSession session, AbstractRecord row) throws DatabaseException { if (shouldCacheQueryResults()) { if (getContainerPolicy().overridesRead()) { throw QueryException.cannotCacheCursorResultsOnQuery(this); } if (isPrepared()) {// only prepared queries can have cached results. Object results = getQueryResults(session, row, true); // Bug6138532 - if results are "cached no results", return null immediately if (results == InvalidObject.instance) { return null; } if (results != null) { return results; } } } return super.execute(session, row); }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (!((Boolean)valueToApply).booleanValue()) { if (query.isReadAllQuery()) { if (((ReadAllQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((ReadAllQuery) query).setContainerPolicy(ContainerPolicy.buildDefaultPolicy()); } } else if (query.isDataReadQuery()) { if (((DataReadQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((DataReadQuery) query).setContainerPolicy(ContainerPolicy.buildDefaultPolicy()); } } } else { if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((ReadAllQuery) query).useCursoredStream(); } } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((DataReadQuery) query).useCursoredStream(); } } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } } return query; } }
DatabaseQuery applyToDatabaseQuery(Object valueToApply, DatabaseQuery query, ClassLoader loader, AbstractSession activeSession) { if (query.isReadAllQuery()) { if (!((ReadAllQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((ReadAllQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((ReadAllQuery) query).getContainerPolicy()).setSizeQuery(new ValueReadQuery((String)valueToApply)); } else if (query.isDataReadQuery()) { if (!((DataReadQuery) query).getContainerPolicy().isCursoredStreamPolicy()) { ((DataReadQuery) query).useCursoredStream(); } ((CursoredStreamPolicy)((ReadAllQuery) query).getContainerPolicy()).setSizeQuery(new ValueReadQuery((String)valueToApply)); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)})); } return query; } }
/** * 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(); }