private void checkOrderBy(ReadQuery query) { if (query.isReadAllQuery()) { ReadAllQuery readAllQuery = (ReadAllQuery) query; List<Expression> orderBy = readAllQuery.getOrderByExpressions(); if ((orderBy == null) || (orderBy.isEmpty())) { JPARSLogger.warning("no_orderby_clause_for_paging", new Object[] { query.toString() }); } } }
private void checkOrderBy(PersistenceContext context, ReadQuery query) { if (query.isReadAllQuery()) { ReadAllQuery readAllQuery = (ReadAllQuery) query; List<Expression> orderBy = readAllQuery.getOrderByExpressions(); if ((orderBy == null) || (orderBy.isEmpty())) { JPARSLogger.warning(context.getSessionLog(), "no_orderby_clause_for_paging", new Object[] { query.toString() }); } } }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return the ordering query keys. * Used for Workbench integration. */ public List<Expression> getOrderByQueryKeyExpressions() { List<Expression> expressions = new ArrayList<Expression> (); if ((getSelectionQuery() != null) && getSelectionQuery().isReadAllQuery()) { for (Expression orderExpression : ((ReadAllQuery)getSelectionQuery()).getOrderByExpressions()) { if (orderExpression.isFunctionExpression() && ((FunctionExpression)orderExpression).getBaseExpression().isQueryKeyExpression()) { expressions.add(orderExpression); } } } return expressions; }
/** * INTERNAL: * Return the base expression to use for adding fields to the query. * This is the reference table. */ @Override protected Expression getAdditionalFieldsBaseExpression(ReadQuery query) { if (query.isReadAllQuery()) { return ((ReadAllQuery)query).getExpressionBuilder(); } else { return ((DataReadQuery)query).getSQLStatement().getBuilder().getTable(getReferenceTable()); } }
/** * INTERNAL: * Return the base expression to use for adding fields to the query. * This is the reference table. */ @Override protected Expression getAdditionalFieldsBaseExpression(ReadQuery query) { if (query.isReadAllQuery()) { return ((ReadAllQuery)query).getExpressionBuilder(); } else { return ((DataReadQuery)query).getSQLStatement().getBuilder().getTable(getReferenceTable()); } }
/** * PUBLIC: * Sets the selection criteria to be used as a where clause to read * reference objects. This criteria is automatically generated by the * TopLink if not explicitly specified by the user. */ public void setSelectionCriteria(Expression anExpression) { if (getSelectionQuery().isReadAllQuery()){ ((ReadAllQuery)getSelectionQuery()).setSelectionCriteria(anExpression); } else { getSelectionQuery().getSQLStatement().setWhereClause(anExpression); } } /**
/** * PUBLIC: * Sets the selection criteria to be used as a where clause to read * reference objects. This criteria is automatically generated by the * TopLink if not explicitly specified by the user. */ @Override public void setSelectionCriteria(Expression anExpression) { if (getSelectionQuery().isReadAllQuery()){ ((ReadAllQuery)getSelectionQuery()).setSelectionCriteria(anExpression); } else { getSelectionQuery().getSQLStatement().setWhereClause(anExpression); } }
/** * PUBLIC: * Sets the selection criteria to be used as a where clause to read * reference objects. This criteria is automatically generated by the * TopLink if not explicitly specified by the user. */ @Override public void setSelectionCriteria(Expression anExpression) { if (getSelectionQuery().isReadAllQuery()){ ((ReadAllQuery)getSelectionQuery()).setSelectionCriteria(anExpression); } else { getSelectionQuery().getSQLStatement().setWhereClause(anExpression); } }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), (RemoteSession)session); } return remoteCursoredStream; }
protected void initializeSelectionStatement(AbstractSession session) { if (selectionQuery.isReadAllQuery()){ ((ReadAllQuery)selectionQuery).addAdditionalField((DatabaseField)getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField((DatabaseField)getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(selectionQuery, null); statement.normalize(session, null); } if (selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)selectionQuery).setResultType(DataReadQuery.MAP); } }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { try { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
@Override protected void initializeSelectionStatement(AbstractSession session) { if (this.selectionQuery.isReadAllQuery()){ ((ReadAllQuery)this.selectionQuery).addAdditionalField(getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)this.selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField(getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(this.selectionQuery, getAdditionalFieldsBaseExpression(this.selectionQuery)); statement.normalize(session, null); } if (this.selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)this.selectionQuery).setResultType(DataReadQuery.MAP); } }
@Override protected void initializeSelectionStatement(AbstractSession session) { if (this.selectionQuery.isReadAllQuery()){ ((ReadAllQuery)this.selectionQuery).addAdditionalField(getDirectField().clone()); } else { SQLSelectStatement statement = (SQLSelectStatement)this.selectionQuery.getSQLStatement(); statement.addTable(getReferenceTable()); statement.addField(getDirectField().clone()); getContainerPolicy().addAdditionalFieldsToQuery(this.selectionQuery, getAdditionalFieldsBaseExpression(this.selectionQuery)); statement.normalize(session, null); } if (this.selectionQuery.isDirectReadQuery()){ ((DirectReadQuery)this.selectionQuery).setResultType(DataReadQuery.MAP); } }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { try { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { try { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }
/** * INTERNAL: * Returns remote cursor stream */ public RemoteCursoredStream cursorSelectObjects(CursoredStreamPolicy policy, DistributedSession session) { try { Transporter transporter = getRemoteSessionController().cursorSelectObjects(new Transporter(policy)); if (!transporter.wasOperationSuccessful()) { throw transporter.getException(); } RemoteCursoredStream remoteCursoredStream = (RemoteCursoredStream)transporter.getObject(); remoteCursoredStream.setSession(session); remoteCursoredStream.setPolicy(policy); if (policy.getQuery().isReadAllQuery() && (!policy.getQuery().isReportQuery())) {// could be DataReadQuery fixObjectReferences(transporter, (ObjectLevelReadQuery)policy.getQuery(), session); } return remoteCursoredStream; } catch (RemoteException exception) { throw CommunicationException.errorInInvocation(exception); } }