Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-86401

OrderByComparators passed to the Persistence layer are not applied

    Details

      Description

      Any OrderByComparator used in a db query executed by BasePersistenceImpl does not get applied. The query that's produced has no order by clause.

      An example of the difference in the query between 7.1 DXP GA1 vs. 7.1.x-private hash c359f2f5238b, produced by the exact same module:
      GA1:

      select commerceco0_.commerceCountryId as commerce1_946_, commerceco0_.uuid_ as uuid2_946_, commerceco0_.groupId as groupId946_, commerceco0_.companyId as companyId946_, commerceco0_.userId as userId946_, commerceco0_.userName as userName946_, commerceco0_.createDate as createDate946_, commerceco0_.modifiedDate as modified8_946_, commerceco0_.name as name946_, commerceco0_.billingAllowed as billing10_946_, commerceco0_.shippingAllowed as shippin11_946_, commerceco0_.twoLettersISOCode as twoLett12_946_, commerceco0_.threeLettersISOCode as threeLe13_946_, commerceco0_.numericISOCode as numeric14_946_, commerceco0_.subjectToVAT as subject15_946_, commerceco0_.priority as priority946_, commerceco0_.active_ as active17_946_, commerceco0_.lastPublishDate as lastPub18_946_ from CommerceCountry commerceco0_ where (commerceco0_.groupId=118605 ) order by  commerceco0_.priority ASC limit 75
      

      c359f2f5238b:

      select commerceco0_.commerceCountryId as commerce1_880_, commerceco0_.uuid_ as uuid2_880_, commerceco0_.groupId as groupId880_, commerceco0_.companyId as companyId880_, commerceco0_.userId as userId880_, commerceco0_.userName as userName880_, commerceco0_.createDate as createDate880_, commerceco0_.modifiedDate as modified8_880_, commerceco0_.name as name880_, commerceco0_.billingAllowed as billing10_880_, commerceco0_.shippingAllowed as shippin11_880_, commerceco0_.twoLettersISOCode as twoLett12_880_, commerceco0_.threeLettersISOCode as threeLe13_880_, commerceco0_.numericISOCode as numeric14_880_, commerceco0_.subjectToVAT as subject15_880_, commerceco0_.priority as priority880_, commerceco0_.active_ as active17_880_, commerceco0_.lastPublishDate as lastPub18_880_ from CommerceCountry commerceco0_ where (commerceco0_.groupId=39325 ) limit 75
      

      Notice at the end of the query that the order by clause is missing in the second query.

      I think this occurs wherever BasePersistenceImpl is used – which is.... like everywhere.

      Thanks to Alessio Rendina for noticing this issue!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brian.chan Brian Chan
                Reporter:
                ethan.bustad Ethan Bustad
                Participants of an Issue:
                Recent user:
                Csaba Turcsan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  1 year, 2 days ago

                  Packages

                  Version Package
                  7.1.10 DXP FP3
                  7.1.1 CE GA2
                  7.1.10.1 SP1
                  7.1.X
                  Master