Uploaded image for project: 'Sentry'
  1. Sentry
  2. SENTRY-2047

isTableEmptyCore method in SentryStore has references to MAuthzPathsMapping when it should be generic

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Sentry
    • Labels:

      Description

      Current isTableEmpty implementation is below

      private boolean isTableEmptyCore(PersistenceManager pm, Class clazz) {
          Query query = pm.newQuery(clazz);
          query.addExtension(LOAD_RESULTS_AT_COMMIT, "false");
          // setRange is implemented efficiently for MySQL, Postgresql (using the LIMIT SQL keyword)
          // and Oracle (using the ROWNUM keyword), with the query only finding the objects required
          // by the user directly in the datastore. For other RDBMS the query will retrieve all
          // objects up to the "to" record, and will not pass any unnecessary objects that are before
          // the "from" record.
          query.setRange(0, 1);
          return ((List<MAuthzPathsMapping>) query.execute()).isEmpty();
        }
      

      We seem to be casting query.execute to a List<MAuthzPathsMapping> when there is no need for it

        Attachments

        1. SENTRY-2047.01.patch
          0.8 kB
          Arjun Mishra
        2. SENTRY-2047.02.patch
          0.8 kB
          Arjun Mishra

          Issue Links

            Activity

              People

              • Assignee:
                arjunmishra13 Arjun Mishra
                Reporter:
                arjunmishra13 Arjun Mishra
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: