001 package com.khubla.pragmatach.framework.dao;
002
003 import java.util.List;
004
005 import com.khubla.pragmatach.framework.api.PragmatachException;
006
007 /**
008 * @author tome
009 */
010 public interface DAO<T, I> {
011 /**
012 * get the count of rows in table
013 */
014 long count() throws PragmatachException;
015
016 /**
017 * delete
018 */
019 void delete(T t) throws PragmatachException;
020
021 /**
022 * delete
023 */
024 void deletebyId(I i) throws PragmatachException;
025
026 /**
027 * find by id
028 */
029 T findById(I i) throws PragmatachException;
030
031 /**
032 * get all
033 */
034 List<T> getAll() throws PragmatachException;
035
036 /**
037 * get all
038 */
039 List<T> getAll(int start, int count) throws PragmatachException;
040
041 Class<I> getIdentifierClazz();
042
043 /**
044 * get pager
045 */
046 Pager<T> getPager(int batchsize) throws PragmatachException;
047
048 Class<T> getTypeClazz();
049
050 /**
051 * do a config reload
052 */
053 void reloadConfig();
054
055 /**
056 * save object
057 */
058 void save(T t) throws PragmatachException;
059
060 /**
061 * update object
062 */
063 void update(T t) throws PragmatachException;
064 }