4 Replies Latest reply: Jun 14, 2005 9:50 AM by 445422 RSS

    appending SQL to expression framework generated queries.

    445422
      I am using MS SQL Server

      It has been recommended to use some hints to help our Report Queries.

      Original recommendation:

      Add

      option (maxdop 1)

      to the end of the query

      i.e. SELECT xxx FROM CUSTOMERS WHERE customerID = 'ALFK' order by customerType option (maxdop 1)

      The following method does not work, but it conveys the idea of what I would like to accomplish. Our report queries are created using the ExpressionBuilders and not "Raw SQL".

      private Object doExecuteQuery(Session session, DatabaseQuery request)
      {
      String HINT = "option (maxdop 1)"
      if (request instanceof ReportQuery)
      {
      String sql = request.getSQLString();
      request.setSQLString(sql + " " + HINT);
      }
      return session.executeQuery(request);
      }

      Is there a way to append SQL to the end of a query? The postFixSQL() methods only append to the end of the where clause, not the end of the whole query, which is what I need.