Class QuerySet<T>

java.lang.Object
com.aashish.javaormashcode.query.QuerySet<T>

public class QuerySet<T> extends Object
  • Constructor Details

    • QuerySet

      public QuerySet(Class<T> modelClass)
  • Method Details

    • asSql

      public String asSql()
      Renders the current query as SQL without binding parameter values.
    • field

      public FieldRef<T,Object> field(String path)
      Creates a field reference scoped to this query's model graph.
    • select

      public QuerySet<T> select(String... fields)
      Replaces the selected columns with the given field paths.
    • select

      public final QuerySet<T> select(FieldRef<?,?>... fields)
      Replaces the selected columns with the given field references.
    • values

      public QuerySet<T> values(String... fields)
    • values

      public final QuerySet<T> values(FieldRef<?,?>... fields)
    • join

      public QuerySet<T> join(String relationName)
      Adds an inner join for the named relation.
    • leftJoin

      public QuerySet<T> leftJoin(String relationName)
      Adds a left join for the named relation.
    • page

      public QuerySet<T> page(int pageNumber, int pageSize)
      Applies pagination using a 1-based page number and page size.
    • paginate

      public QuerySet<T> paginate(PageRequest request)
      Applies pagination from the given page request.
    • nextPage

      public QuerySet<T> nextPage()
      Advances the current offset by one page.
    • previousPage

      public QuerySet<T> previousPage()
      Moves the current offset back by one page without going below zero.
    • all

      public List<T> all()
      Executes the select query using the configured primary data source.
    • all

      public List<T> all(DataSource dataSource)
      Executes the select query using the given data source.
    • all

      public List<T> all(OrmSession session)
      Executes the select query within the given ORM session.
    • all

      public <R> List<R> all(Class<R> dtoClass)
      Executes the select query and maps rows into the given DTO type.
    • all

      public <R> List<R> all(Class<R> dtoClass, DataSource dataSource)
      Executes the select query against the given data source and maps rows into the DTO type.
    • all

      public <R> List<R> all(Class<R> dtoClass, OrmSession session)
      Executes the select query within the given session and maps rows into the DTO type.
    • aggregate

      public Map<String,Object> aggregate(Aggregate... aggregates)
      Executes one or more aggregate projections using the configured primary data source.
    • aggregate

      public Map<String,Object> aggregate(DataSource dataSource, Aggregate... aggregates)
      Executes one or more aggregate projections using the given data source.
    • aggregate

      public Map<String,Object> aggregate(OrmSession session, Aggregate... aggregates)
      Executes one or more aggregate projections within the given session.
    • annotate

      public QuerySet<T> annotate(Subquery subquery)
      Adds a subquery projection to the current select list.
    • filter

      public QuerySet<T> filter(String lookupExpression, Object value)
      Adds a filter using a lookup expression such as name__icontains.
    • filter

      public QuerySet<T> filter(FieldRef<?,?> field, Object value)
      Adds an exact-match filter for the given field reference.
    • order

      public QuerySet<T> order(String column, boolean ascending)
      Adds an ordering clause for the given column or field path.
    • order

      public QuerySet<T> order(FieldRef<?,?> field, boolean ascending)
      Adds an ordering clause for the given field reference.
    • limit

      public QuerySet<T> limit(int limit)
      Sets the maximum number of rows returned by the query.
    • offset

      public QuerySet<T> offset(int offset)
      Sets the number of rows to skip before returning results.
    • insert

      public int insert(Map<String,Object> values)
      Inserts a row using the configured primary data source.
    • insert

      public int insert(Map<String,Object> values, DataSource dataSource)
      Inserts a row using the given data source.
    • insert

      public int insert(Map<String,Object> values, OrmSession session)
      Inserts a row within the given session.
    • update

      public int update(Map<String,Object> values)
      Updates rows matched by the current filters using the configured primary data source.
    • update

      public int update(Map<String,Object> values, DataSource dataSource)
      Updates rows matched by the current filters using the given data source.
    • update

      public int update(Map<String,Object> values, OrmSession session)
      Updates rows matched by the current filters within the given session.
    • delete

      public int delete()
      Deletes rows matched by the current filters using the configured primary data source.
    • delete

      public int delete(DataSource dataSource)
      Deletes rows matched by the current filters using the given data source.
    • delete

      public int delete(OrmSession session)
      Deletes rows matched by the current filters within the given session.
    • getState

      public QueryState getState()
      Exposes the mutable query state backing this query set.