Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2826

CacheQuery.list() returns List<Object>, which is hard to cast

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Minor Minor
    • 9.0.0.Final
    • None
    • Embedded Querying
    • None

      In example for Books in https://docs.jboss.org/author/display/ISPN/Querying+Infinispan

      ~~ snip snip ~~
      CacheQuery query = searchManager.getQuery(luceneQuery, Book.class);
      // and there are your results!
      List<Book> objectList = query.list();
      ~~ snip snip ~~

      This doesn't actually work. CacheQuery.list() returns List<Object>

      Thus, you will need to cast: List<Book> books = (List<Book>) cq.list();
      But this wouldn't work... Instead you'll end up doing: List<Book> books = (List<Book>)(List<?>) cq.list();

              anistor Adrian Nistor (Inactive)
              saturnism_jira Ray Tsang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: