不要被这个世界改变!|

一个支持泛型的DAO接口类

这本来是个分享的,但插件不好使了,等有时间在搞一个
 
						/**
 * Defines a generic DAO interface.
 * 
 * @author javier
 * 
 * @param 
 *            The type this DAO handles.
 * @param 
 *            The type of the id of the handled entity.
 */
public interface DAOInterface
{

    /**
     * Makes the given entity persistent.
     *
     * @param entity The entity to persist.
     * @throws When the quota of instances for that entity was exceeded.
     */
    void makePersistent(T entity) throws QuotaExceededException;

    /**
     * Makes the given entity transient.
     *
     * @param entity The entity to make transient.
     */
    void makeTransient(T entity);

    /**
     * @return the number of matching entities.
     */
    int count(Filter filter);

    /**
     * Returns a single entity which has the given ID or throws an
     * EntityNotFoundException if no matching entity is found.
     * 
     * @param id
     *            The ID of the entity to return.
     * @return The entity.
     */
    T findById(ID id) throws EntityNotFoundException;

    /**
     * Returns all matching entities of type T.
     * 
     * @param filter
     *            The Filter to use.
     *
     * @return An ordered List with the entities.
     */
    List find(Filter filter);

    /**
     * Returns all entities of type T.
     * 
     * @return An ordered List with the entities.
     */
    List findAll();

    /**
     * Returns a page of entities.
     * 
     * @param filter
     *            The Filter to use.
     * @param startRow
     *            The offset.
     * @param pageSize
     *            The number of entities to return.
     *
     * @return A Pair of values. The first value is the
     *         List of entities and the second one if the total
     *         number of existing entities.
     */
    Pair<>, Integer> findPaged(Filter filter, int startRow, int pageSize);

    /**
     * Flushing is the process of synchronising the underlying persistent
     * store with persistable state held in memory. 
     */
    void flush();
}
						//该余额宝领红包码来自于http://www.codesnippet.cn/detail/190320132482.html