Code example for DetachedCriteria

Methods: add

0
	 * @param criteria The {@link DetachedCriteria} to fulfill. 
	 * @param maxResults Maximum quantity of results to find. 
	 * @return The random list. 
	 */ 
	protected List<T> findRandomList(DetachedCriteria criteria, Integer maxResults) {
		criteria.add(getRandomRestriction());
		return find(criteria, maxResults);
	} 
	 
	protected PagedResult<T> findRandom(DetachedCriteria detachedCriteria, Pager pager, Sorting sorting) {
		detachedCriteria.add(getRandomRestriction());
		return find(detachedCriteria, pager, sorting);
	} 
	 
	/** 
	 * @see com.jdroid.java.repository.RandomRepository#getRandom() 
	 */ 
	@Override 
	public T getRandom() { 
		return getRandom(createDetachedCriteria());