T - the entity class related to this DAO.K - the type of the field that represents the entity class' primary key.public interface ReadableDAO<T,K extends Serializable>
| Modifier and Type | Method and Description |
|---|---|
long |
countAll()
Returns the total number of objects of this class.
|
List<T> |
findAll()
Returns the all instances of the related entity class.
|
List<T> |
findAll(int firstResult,
int maxResults,
SortCriterion... sortingConstraints)
Returns the all instances of the related entity class, but in a paginated fashion.
|
List<T> |
findByExample(T example)
Executes a query by example.
|
T |
findById(K id)
Returns the object with a given primary key value.
|
List<T> |
findByIds(K... ids)
Returns the objects with some given primary key values.
|
SortCriterion[] |
getDefaultSortCriteria()
Returns the default
SortCriterions to be used to sort the objects lists returned by
methods like findAll() and findAll(int, int, SortCriterion...) when no
sort constraints are given. |
T |
reattach(T object)
Reattaches an object to the persistence context, if there is one.
|
T |
refresh(T object)
Refreshes an object, getting the most recent version of its data from the object store.
|
long countAll()
long.T findById(K id)
id - a K.T.List<T> findByIds(K... ids)
ids - a K array.List of T.List<T> findAll()
List of T.List<T> findByExample(T example)
example - a T.List of T.T refresh(T object)
object - a TT, which may or may not be the same object passed in the parameter.T reattach(T object)
object - a T.T.List<T> findAll(int firstResult, int maxResults, SortCriterion... sortingConstraints)
firstResult - an int with the index of the first object to be returned.
The first object has index 0.maxResults - an int with the maximum number of objects to be returned.sortingConstraints - an SortCriterion array used to define how the returned
list will be sorted.List of T.SortCriterion[] getDefaultSortCriteria()
SortCriterions to be used to sort the objects lists returned by
methods like findAll() and findAll(int, int, SortCriterion...) when no
sort constraints are given.SortCriterion array. It cannot be null.Copyright © 2008-2013 Ars Machina Tecnologia da Informação Ltda.. All Rights Reserved.