Class AbstractDBQueryBuilder<T extends DBData>

java.lang.Object
com.jalios.jcms.db.AbstractDBQueryBuilder<T>
Direct Known Subclasses:
AccessTokenQueryBuilder, BackgroundProcessQueryBuilder, PublicLinkQueryBuilder, TrackerInfoQueryBuilder

public abstract class AbstractDBQueryBuilder<T extends DBData> extends Object
  • Field Details

    • author

      protected Member author
    • firstResult

      protected int firstResult
    • maxResults

      protected int maxResults
    • order

      protected org.hibernate.criterion.Order order
    • defaultOrder

      protected org.hibernate.criterion.Order defaultOrder
    • counting

      protected boolean counting
    • noPaging

      protected boolean noPaging
  • Constructor Details

    • AbstractDBQueryBuilder

      public AbstractDBQueryBuilder()
  • Method Details

    • getDBDataClass

      protected Class<T> getDBDataClass()
      Returns:
      the queried DBData class.
      Since:
      jcms-10.0.5
    • setDefaultOrder

      protected void setDefaultOrder(org.hibernate.criterion.Order defaultOrder)
      Sets the default order to use if no order has been defined.
      Parameters:
      defaultOrder - the default order.
      Since:
      jcms-10.0.5
    • author

      public AbstractDBQueryBuilder<T> author(Member author)
      Parameters:
      author - the author
      Returns:
      the PublicLinkQueryBuilder
      Since:
      jcms-10.0.5
    • firstResult

      public AbstractDBQueryBuilder<T> firstResult(int firstResult)
      Parameters:
      firstResult - set the first pubLink to retrieve. If <= 0, rows will be retrieved beginning from first pubLink.
      Returns:
      the AbstractDBQueryBuilder
      Since:
      jcms-10.0.5
    • maxResults

      public AbstractDBQueryBuilder<T> maxResults(int maxResults)
      Parameters:
      maxResults - set the maximum pubLink to retrieve. If < 0, there is no limit to the number of pubLink retrieved.
      Returns:
      the AbstractDBQueryBuilder
      Since:
      jcms-10.0.5
    • noPaging

      public AbstractDBQueryBuilder<T> noPaging()
      Force no paging for this criteria
      Returns:
      the AbstractDBQueryBuilder
      Since:
      jcms-10.0.5
    • orderBy

      public AbstractDBQueryBuilder<T> orderBy(org.hibernate.criterion.Order order)
      Parameters:
      order - the order
      Returns:
      the AbstractDBQueryBuilder
      Since:
      jcms-10.0.5
    • counting

      protected AbstractDBQueryBuilder counting(boolean counting)
    • build

      public org.hibernate.Criteria build()
      Returns:
      the criteria built from the all the criterion, the firstResult, the maxResults and the order.
      Since:
      jcms-10.0.5
    • createCriteria

      protected org.hibernate.Criteria createCriteria(int firstResult, int maxResults)
    • addCriterions

      protected abstract void addCriterions(org.hibernate.Criteria criteria)
      To override to add the custom criterion
      Parameters:
      criteria - the Criteria
      Since:
      jcms-10.0.5
    • addAuthorCriterion

      protected void addAuthorCriterion(org.hibernate.Criteria criteria)
      Add the author criterion
      Parameters:
      criteria - the Criteria
      Since:
      jcms-10.0.5
    • list

      public List<T> list()
      Returns:
      the list of results
      Since:
      jcms-10.0.5
    • first

      public T first()
      Returns:
      the first result (or null if there is no result)
      Since:
      jcms-10.0.5
    • count

      public int count()
      Returns:
      the count of result.
      Since:
      jcms-10.0.5
    • scroll

      public org.hibernate.ScrollableResults scroll()
      Returns:
      a ScrollableResults (FORWARD_ONLY with the default fetch size)
      Since:
      jcms-10.0.5
    • scroll

      public org.hibernate.ScrollableResults scroll(org.hibernate.ScrollMode scrollMode, int fetchSize)
      Parameters:
      scrollMode - the scroll mode
      fetchSize - the fetch size
      Returns:
      a ScrollableResults
      Since:
      jcms-10.0.5