1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.core.persistence.jpa.dao;
20
21 import java.util.List;
22 import javax.persistence.TypedQuery;
23 import org.apache.syncope.core.persistence.api.dao.ConfParamDAO;
24 import org.apache.syncope.core.persistence.api.entity.ConfParam;
25 import org.apache.syncope.core.persistence.jpa.entity.JPAConfParam;
26 import org.springframework.transaction.annotation.Transactional;
27
28 public class JPAConfParamDAO extends AbstractDAO<ConfParam> implements ConfParamDAO {
29
30 @Transactional(readOnly = true)
31 @Override
32 public List<ConfParam> findAll() {
33 TypedQuery<ConfParam> query = entityManager().createQuery(
34 "SELECT e FROM " + JPAConfParam.class.getSimpleName() + " e ORDER BY e.id ASC", ConfParam.class);
35 return query.getResultList();
36 }
37
38 @Transactional(readOnly = true)
39 @Override
40 public ConfParam find(final String key) {
41 return entityManager().find(JPAConfParam.class, key);
42 }
43
44 @Override
45 public ConfParam save(final ConfParam confParam) {
46 return entityManager().merge(confParam);
47 }
48
49 @Override
50 public void delete(final String key) {
51 ConfParam param = find(key);
52 if (param != null) {
53 entityManager().remove(param);
54 }
55 }
56 }