Package com.jalios.jcms.db
Class AbstractDBQueryBuilder<T extends DBData>
- java.lang.Object
-
- com.jalios.jcms.db.AbstractDBQueryBuilder<T>
-
- Direct Known Subclasses:
AccessTokenQueryBuilder
,BackgroundProcessQueryBuilder
,PublicLinkQueryBuilder
public abstract class AbstractDBQueryBuilder<T extends DBData> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected Member
author
protected boolean
counting
protected org.hibernate.criterion.Order
defaultOrder
protected int
firstResult
protected int
maxResults
protected boolean
noPaging
protected org.hibernate.criterion.Order
order
-
Constructor Summary
Constructors Constructor Description AbstractDBQueryBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
addAuthorCriterion(org.hibernate.Criteria criteria)
Add the author criterionprotected abstract void
addCriterions(org.hibernate.Criteria criteria)
To override to add the custom criterionAbstractDBQueryBuilder<T>
author(Member author)
org.hibernate.Criteria
build()
int
count()
protected AbstractDBQueryBuilder
counting(boolean counting)
protected org.hibernate.Criteria
createCriteria(int firstResult, int maxResults)
T
first()
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.ScrollableResults
scroll()
org.hibernate.ScrollableResults
scroll(org.hibernate.ScrollMode scrollMode, int fetchSize)
protected void
setDefaultOrder(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
-
-