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

Passing empty list to query criterion "in" cause SQL syntax error.

    Details

      Description

      This code cause SQL syntax error.

      Collection<Long> userIds = new ArrayList<Long>();

      DynamicQuery userQuery = DynamicQueryFactoryUtil.forClass(User.class).add(PropertyFactoryUtil.forName("companyId").eq(companyId))
      .add(PropertyFactoryUtil.forName("userId").in(userIds.toArray()));

      List<User> users = userLocalService.dynamicQuery(userQuery);

        Attachments

          Activity

            People

            • Assignee:
              mika.koivisto Mika Koivisto
              Reporter:
              lcharlois Laurent CHARLOIS (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 25 weeks, 6 days ago

                Packages

                Version Package
                6.1.1 CE GA2