1 Reply Latest reply on Aug 22, 2011 10:23 AM by sannegrinovero

    Is Infinispan query supporting to return distinct result?

    lmcjroh

      Hi

       

      In SQL, we have "distinct" keyword to return unique result.

      In Hibernate, Projections is used with Criteria to return distinct result.

       

      Criteria crit = session.createCriteria(Survey.class);

      ProjectionList projList = Projections.projectionList();

      projList.add(Projections.countDistinct("Id"));

       

      But, in the case, I need to get Session.

      I am not sure how to get Session in Infinispan.

      Or is there any way to get unique result from Query module in Infinispan?

       

      Thanks.

        • 1. Re: Is Infinispan query supporting to return distinct result?
          sannegrinovero

          Hi JaeHee,

          the technology behind the Query module is not a good fit to implement a "Distinct" operation.

          Still all retrieved entities are going to be unique.. or are you needing to apply the distinct to a property of your objects?

           

          In that case you'll have to use a Map/Reduce operation using the Distributed Executor API, that's better suited for this task.