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

Ickle query fails with unknown alias error when using projection

    XMLWordPrintable

Details

    Description

      In Keycloak, we want to use following query with projection of id field: 

      SELECT id FROM kc.HotRodUserSessionEntity c WHERE ((c.realmId = :realmId0) AND (c.offline = :offline0) AND (c.authenticatedClientSessions.clientId = :authenticatedClientSessionsclientId0)) ORDER BY lastSessionRefresh ASC
      

      Id field is not indexed thus there is no projectable = true on the field. Rest of the fields used in the query are indexed.

      // HotRodUserSessionEntity
      @ProtoField(number = 2)
      public String id;
      
      @Basic(sortable = true)
      @ProtoField(number = 3)
      public String realmId;
      
      @Basic(sortable = true)
      @ProtoField(number = 17)
      public Boolean offline;
      
      @Basic(sortable = true)
      @ProtoField(number = 16)
      public Set<HotRodAuthenticatedClientSessionEntityReference> authenticatedClientSessions;
      -- end of HotRodUserSessionEntity --
      
      // HotRodAuthenticatedClientSessionEntityReference
      @Basic(sortable = true)
      @ProtoField(number = 1)
      public String clientId;
      

      The query fails with the following error: ISPN028502: Unknown alias: authenticatedClientSessions.

      This seems like a bug to us. It should be possible to project a field even if there is no index on it. We discussed something similar here https://issues.redhat.com/browse/ISPN-8584

      Attachments

        Activity

          People

            fercoli@redhat.com Fabio Massimo Ercoli
            mkanis Martin Kanis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: