/** * <p>Shortcut for {@link #columns(Property, Property[])} columns}(Property.COUNT)</p> */ public ColumnSelect<Object[]> count() { return columns(Property.COUNT); }
/** * <p>Select COUNT(property)</p> * <p>Can return different result than COUNT(*) as it will count only non null values</p> * @see ColumnSelect#count() */ public ColumnSelect<Object[]> count(Property<?> property) { return columns(property.count()); }
/** * <p>Select maximum value of property</p> * @see ColumnSelect#columns(Property, Property[]) */ public ColumnSelect<Object[]> max(Property<?> property) { return columns(property.max()); }
/** * <p>Select average value of property</p> * @see ColumnSelect#columns(Property, Property[]) */ public ColumnSelect<Object[]> avg(Property<?> property) { return columns(property.avg()); }
/** * <p>Select minimum value of property</p> * @see ColumnSelect#columns(Property, Property[]) */ public ColumnSelect<Object[]> min(Property<?> property) { return columns(property.min()); }
/** * <p>Select sum of values</p> * @see ColumnSelect#columns(Property, Property[]) */ public <E extends Number> ColumnSelect<Object[]> sum(Property<E> property) { return columns(property.sum()); }
/** * <p>Select only specific properties.</p> * <p>Can be any properties that can be resolved against root entity type * (root entity's properties, function call expressions, properties of relationships, etc).</p> * <p> * <pre> * {@code * List<Object[]> columns = ObjectSelect.query(Artist.class) * .columns(Artist.ARTIST_NAME, Artist.DATE_OF_BIRTH) * .select(context); * } * </pre> * * @param properties array of properties to select * @see ObjectSelect#column(Property) */ public ColumnSelect<Object[]> columns(Property<?> firstProperty, Property<?>... properties) { return new ColumnSelect<>(this).columns(firstProperty, properties); }
/** * Creates a ColumnSelect that will fetch multiple columns of a given {@link ObjEntity} * * @param entityType base persistent class that will be used as a root for this query * @param firstColumn column to select * @param otherColumns columns to select */ public static ColumnSelect<Object[]> columnQuery(Class<?> entityType, Property<?> firstColumn, Property<?>... otherColumns) { return new ColumnSelect<Object[]>().entityType(entityType).columns(firstColumn, otherColumns); }