1
2
3
4
5
6
7
8
9 package org.directdemocracyportal.democracy.service.dao;
10
11 import java.io.Serializable;
12 import java.util.List;
13
14 import org.directdemocracyportal.democracy.model.core.BaseEntity;
15 import org.springframework.dao.DataAccessException;
16
17
18 /***
19 * The Interface GenericDAO.
20 *
21 * @param <T> the generic type
22 * @param <ID> the generic type
23 */
24 public abstract interface GenericDAO<T extends BaseEntity, ID extends Serializable>
25 {
26
27 /***
28 * Load.
29 *
30 * @param id the id
31 * @return the t
32 * @throws DataAccessException the data access exception
33 */
34 public T load(ID id) throws DataAccessException;
35
36 /***
37 * Save.
38 *
39 * @param entity the entity
40 * @return the t
41 * @throws DataAccessException the data access exception
42 */
43 public T save(T entity) throws DataAccessException;
44
45 /***
46 * Delete.
47 *
48 * @param entity the entity
49 * @throws DataAccessException the data access exception
50 */
51 public void delete(T entity) throws DataAccessException;
52
53 /***
54 * Gets the all.
55 *
56 * @return the all
57 * @throws DataAccessException the data access exception
58 */
59 public List<T> getAll() throws DataAccessException;
60 }