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

Finder "where" attribute column conflict

    Details

      Description

      Hello,
      I found possibly a bug in creating finder with where clause.

      service.xml

      <entity name="Person" local-service="true" remote-service="false">
              <column name="id" type="long" primary="true"></column>
              <column name="name" type="String"></column>
              <column name="nickname" type="String"></column>
              <finder name="Name_nickNameNotnull" where="nickname is not NULL" return-type="Collection">
                  <finder-column name="name"></finder-column>
              </finder>
      </entity>
      

      After succesful service builder run, this is part of the persitence file which it generated.

      PersonPersistenceImpl.java

      private static final String _FINDER_COLUMN_NAME_NICKNAMENOTNULL_NAME_2 = "person.name = ? AND nickperson.name is not NULL";
      

      However expected result should be like this:

      private static final String _FINDER_COLUMN_NAME_NICKNAMENOTNULL_NAME_2 = "person.name = ? AND person.nickname is not NULL";
      

      The problem is when your column name contains another column name. In this example it was name - nickname. I found it out with id - validTo. Looks like the service builder looks for column string, while it should look for whole word only.

        Attachments

          Activity

            People

            Assignee:
            shuyang.zhou Shuyang Zhou
            Reporter:
            nitram94@gmail.com Martin Vaněk
            Participants of an Issue:
            Recent user:
            Yunlin "Steven" Sun
            Engineering Assignee:
            Tina Tian
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              42 weeks, 6 days ago

                Packages

                Version Package
                7.0.0 DXP FP97
                7.0.X
                7.1.10 DXP FP21
                7.1.X
                7.2.10 DXP FP10
                7.2.10.4 DXP SP4
                7.2.X
                7.3.10 DXP FP1
                7.3.10.1 DXP SP1
                7.3.6 CE GA7
                7.3.X
                Master