Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • Core Library
    • None

    Description

      1. new methods in ObjectSelect and ColumnSelect
        • min
        • max
        • avg
        • sum
        • count
      2. new methods in Property class
        • min
        • max
        • avg
        • sum
        • count
        • plus constant Property.COUNT
      3. ColumnSelect can be created only via ObjectSelect (methods columnQuery(...))
      // Select COUNT(*) examples:
      long count = ObjectSelect
              .columnQuery(Artist.class, Property.COUNT) // constant property
              .selectOne(context);
      
      long count2 = ObjectSelect
              .query(Artist.class)
              .count()
              .selectOne(context);
      
      long count3 = ObjectSelect
              .query(Artist.class)
              .selectCount(context); //  new select*() method
      
      // Select COUNT(attributes) examples:
      long count2 = ObjectSelect
              .columnQuery(Artist.class, Artist.DATE_OF_BIRTH.count()) // new methods in Property class
              .selectOne(context);
      
      long count3 = ObjectSelect
              .query(Artist.class)
              .count(Artist.DATE_OF_BIRTH)
              .selectOne(context);
      
      // All aggregates:
      Property<BigDecimal> estimatedPrice = Artist.PAINTING_ARRAY.dot(Painting.ESTIMATED_PRICE);
      Object[] minMaxAvgSumCount = ObjectSelect.query(Artist.class)
              .where(estimatedPrice.gte(min))
              .min(estimatedPrice)
              .max(estimatedPrice)
              .avg(estimatedPrice)
              .sum(estimatedPrice)
              .count()
              .selectOne(context);
      

      Attachments

        Activity

          People

            ntimofeev Nikita Timofeev
            ntimofeev Nikita Timofeev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: