/** * <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); }
/** * <p>Select one specific property.</p> * <p>Can be any property that can be resolved against root entity type * (root entity's property, function call expression, property of relationships, etc)</p> * <p>If you need several columns use {@link ObjectSelect#columns(Property, Property[])} method.</p> * <p> * <pre> * {@code * List<String> names = ObjectSelect.query(Artist.class) * .column(Artist.ARTIST_NAME) * .select(context); * } * </pre> * </p> * @param property single property to select * @see ObjectSelect#columns(Property, Property[]) */ public <E> ColumnSelect<E> column(Property<E> property) { return new ColumnSelect<>(this).column(property); }
/** * Creates a ColumnSelect that will fetch single property that can be resolved * against a given {@link ObjEntity} class. * * @param entityType base persistent class that will be used as a root for this query * @param column single column to select */ public static <E> ColumnSelect<E> columnQuery(Class<?> entityType, Property<E> column) { return new ColumnSelect<>().entityType(entityType).column(column); }
/** * 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); }