DAO 类是否负责处理以下所有方法?或者最好将一些方法排除在服务层中?
我在这里找到了这个界面。我考虑在我的代码中重复这个接口..
public interface GeneralDAO {
public <T> T find(Class<T> type, Serializable id);
public <T> T[] find(Class<T> type, Serializable... ids);
public <T> T getReference(Class<T> type, Serializable id);
public <T> T[] getReferences(Class<T> type, Serializable... ids);
public boolean save(Object entity);
public boolean[] save(Object... entities);
public boolean remove(Object entity);
public void remove(Object... entities);
public boolean removeById(Class<?> type, Serializable id);
public void removeByIds(Class<?> type, Serializable... ids);
public <T> List<T> findAll(Class<T> type);
public List search(ISearch search);
public Object searchUnique(ISearch search);
public int count(ISearch search);
public SearchResult searchAndCount(ISearch search);
public boolean isAttached(Object entity);
public void refresh(Object... entities);
public void flush();
public Filter getFilterFromExample(Object example);
public Filter getFilterFromExample(Object example, ExampleOptions options);
}