Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1673

[CAN'T REPRODUCE] jdoqlFromClause validator is too strict, does not allow for NOT EXISTS

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.14.0
    • Fix Version/s: 1.15.0
    • Component/s: None
    • Labels:
      None

      Description

      For example:

      @Query(
                      name = "findNotInAnyPaymentBatchByApprovalStateAndPaymentMethod", language = "JDOQL",
                      value = "SELECT "
                              + "FROM org.estatio.capex.dom.invoice.IncomingInvoice "
                              + "WHERE !(SELECT invoice "
                              +         "  FROM org.estatio.capex.dom.payment.PaymentLine).contains(this) "
                              + "   && approvalState == :approvalState "
                              + "   && paymentMethod == :paymentMethod "
                              + "ORDER BY invoiceDate ASC " // oldest first
              ),
      

        Activity

        Hide
        danhaywood Dan Haywood added a comment -

        hmm, seems ok. The regex that pulls out the table name is:

        
        

        private final static Pattern fromPattern = Pattern.compile("SELECT.?FROM\\s([^\\s]).", Pattern.CASE_INSENSITIVE);
        {code

        Note the "SELECT.*?FROM", in other words this is a non-greedy match. As such it will correctly locate IncomingInvoice rather than PaymentLine.

        Show
        danhaywood Dan Haywood added a comment - hmm, seems ok. The regex that pulls out the table name is: private final static Pattern fromPattern = Pattern.compile("SELECT. ?FROM \\s ( [^\\s] ). ", Pattern.CASE_INSENSITIVE); {code Note the "SELECT.*?FROM", in other words this is a non-greedy match. As such it will correctly locate IncomingInvoice rather than PaymentLine.

          People

          • Assignee:
            danhaywood Dan Haywood
            Reporter:
            danhaywood Dan Haywood
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development