Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3500

Roo generates finder with unresolved local jpaQuery variable in sortFieldName method

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 1.2.5.RELEASE
    • Fix Version/s: 1.3.0.RELEASE
    • Component/s: PERSISTENCE
    • Labels:
      None

      Description

      Here's a roo generated finder method that contains an unresolved local variable "jpaQuery":

      public static TypedQuery<CmTitle> CmTitle.findCmTitlesByCategories(Set<Category> categories, String sortFieldName, String sortOrder) {
      if (categories == null) throw new IllegalArgumentException("The categories argument is required");
      EntityManager em = CmTitle.entityManager();
      StringBuilder queryBuilder = new StringBuilder("SELECT o FROM CmTitle AS o WHERE");
      for (int i = 0; i < categories.size(); i++)

      { if (i > 0) queryBuilder.append(" AND"); queryBuilder.append(" :categories_item").append(i).append(" MEMBER OF o.categories"); }

      if (fieldNames4OrderClauseFilter.contains(sortFieldName)) {
      jpaQuery = jpaQuery + " ORDER BY " + sortFieldName;
      if ("ASC".equalsIgnoreCase(sortOrder) || "DESC".equalsIgnoreCase(sortOrder))

      { queryBuilder.append(" " + sortOrder); }

      }
      TypedQuery<CmTitle> q = em.createQuery(queryBuilder.toString(), CmTitle.class);
      int categoriesIndex = 0;
      for (Category _category: categories)

      { q.setParameter("categories_item" + categoriesIndex++, _category); }

      return q;
      }

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            bedge42 Bruce Edge
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: