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

DynamicQuery with IN restriction - values for IN are not populated in the sql

    Details

    • Branch Version/s:
      6.0.x
    • Backported to Branch:
      Committed

      Description

      When DynamicQuery is created with IN restriction, provided IN values are not populated in the generated SQL, resulting an empty list.

      Example:
      --------------------------------------
      String[] regionCodes = new String[]

      {"AB", "NB", "YT"}

      ;

      DynamicQuery queryRegion = DynamicQueryFactoryUtil.forClass(
      Region.class, PortalClassLoaderUtil.getClassLoader());

      queryRegion.setProjection(
      ProjectionFactoryUtil.property("regionId"));
      queryRegion.add(
      RestrictionsFactoryUtil.in("regionCode", regionCodes));

      List results = null;
      try

      { results = ExpandoValueLocalServiceUtil.dynamicQuery(queryRegion); }

      catch (SystemException e)

      { e.printStackTrace(); }

      if (results != null && !results.isEmpty()) {
      for (Object regionCode : results)

      { System.out.println("---> " + regionCode); }

      }
      --------------------------------------
      Returned list is empty.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

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

                  Packages

                  Version Package
                  --Sprint - SP
                  6.0.12 EE
                  6.1.0 CE RC1