Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1352

Support count in Criteria

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Data-Module
    • None

    Description

      Hi. I'm filtering using "Criteria" by some  conditions It works correctly and get the list of item that meets the conditions. I would like to get the count of items which meets the conditions without getting this list in memory, I just want to query this count number.

      Thanks in advance.

      ""

          int findUserByCriteria(String name, Boolean active,  Integer idrol){

              Criteria<User, User> c = criteria();
              
              if(name != null)
                  c.likeIgnoreCase(User_.name, name + "%");
              
              if(active != null)
                  c.eq(User_.active, active);
              
              if(idrol != null)
                  c.eq(User_.idRol, idrol);

      .....

            int count = ¿?

      .....

      return count;

      }

      ""

      Attachments

        Activity

          People

            Unassigned Unassigned
            mojo code mojo code
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: