Package com.jalios.jcms.db
Class AbstractDBQueryBuilder<T extends DBData>
- java.lang.Object
-
- com.jalios.jcms.db.AbstractDBQueryBuilder<T>
-
- Direct Known Subclasses:
PublicLinkQueryBuilder
public abstract class AbstractDBQueryBuilder<T extends DBData> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Memberauthorprotected booleancountingprotected org.hibernate.criterion.OrderdefaultOrderprotected intfirstResultprotected intmaxResultsprotected booleannoPagingprotected org.hibernate.criterion.Orderorder
-
Constructor Summary
Constructors Constructor Description AbstractDBQueryBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddAuthorCriterion(org.hibernate.Criteria criteria)Add the author criterionprotected abstract voidaddCriterions(org.hibernate.Criteria criteria)To override to add the custom criterionAbstractDBQueryBuilder<T>author(Member author)org.hibernate.Criteriabuild()intcount()protected AbstractDBQueryBuildercounting(boolean counting)protected org.hibernate.CriteriacreateCriteria(int firstResult, int maxResults)Tfirst()AbstractDBQueryBuilder<T>firstResult(int firstResult)protected java.lang.Class<T>getDBDataClass()java.util.List<T>list()AbstractDBQueryBuilder<T>maxResults(int maxResults)AbstractDBQueryBuilder<T>noPaging()Force no paging for this criteriaAbstractDBQueryBuilder<T>orderBy(org.hibernate.criterion.Order order)org.hibernate.ScrollableResultsscroll()org.hibernate.ScrollableResultsscroll(org.hibernate.ScrollMode scrollMode, int fetchSize)protected voidsetDefaultOrder(org.hibernate.criterion.Order defaultOrder)Sets the default order to use if no order has been defined.
-
-
-
Field Detail
-
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
-
-
Method Detail
-
getDBDataClass
protected java.lang.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 java.util.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 modefetchSize- the fetch size- Returns:
- a ScrollableResults
- Since:
- jcms-10.0.5
-
-