Revision 47598
Added by Antonis Lempesis almost 7 years ago
HelpDAO.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import eu.dnetlib.goldoa.domain.Help; |
4 | 4 |
import org.hibernate.criterion.Restrictions; |
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.jdbc.core.JdbcTemplate; |
|
7 |
import org.springframework.jdbc.core.RowMapper; |
|
8 | 5 |
import org.springframework.stereotype.Repository; |
9 | 6 |
|
10 |
import javax.sql.DataSource; |
|
11 |
import java.sql.ResultSet; |
|
12 |
import java.sql.SQLException; |
|
13 |
import java.sql.Types; |
|
14 | 7 |
import java.util.List; |
15 | 8 |
|
16 | 9 |
/* |
... | ... | |
19 | 12 |
@Repository |
20 | 13 |
public class HelpDAO extends AbstractDao<String,Help>{ |
21 | 14 |
|
22 |
private final static String UPDATE_HELP = "update help set name=?, text=? where id=?"; |
|
23 |
private final static String INSERT_HELP = "insert into help (name, text, id) values (?, ?, ?)"; |
|
24 |
private final static String GET_BY_ID = "select id, name, text from help where id = ?"; |
|
25 |
private final static String GET_ALL = "select id, name, text from help"; |
|
26 |
private final static String DELETE = "delete from help where id = ?"; |
|
15 |
// private final static String UPDATE_HELP = "update help set name=?, text=? where id=?";
|
|
16 |
// private final static String INSERT_HELP = "insert into help (name, text, id) values (?, ?, ?)";
|
|
17 |
// private final static String GET_BY_ID = "select id, name, text from help where id = ?";
|
|
18 |
// private final static String GET_ALL = "select id, name, text from help";
|
|
19 |
// private final static String DELETE = "delete from help where id = ?";
|
|
27 | 20 |
|
28 | 21 |
|
29 | 22 |
public Help saveHelp(Help help) { |
... | ... | |
32 | 25 |
} |
33 | 26 |
|
34 | 27 |
public Help getById(String id) { |
35 |
return (Help) createEntityCriteria().add(Restrictions.eq("id", id)).list().get(0); |
|
28 |
List<Help> res = createEntityCriteria().add(Restrictions.eq("id", id)).list(); |
|
29 |
|
|
30 |
if (!res.isEmpty()) |
|
31 |
return res.get(0); |
|
32 |
else |
|
33 |
return null; |
|
36 | 34 |
} |
37 | 35 |
@SuppressWarnings("unchecked") |
38 | 36 |
public List<Help> getAll() { |
Also available in: Unified diff
- Fixed duplicate dependncies
- Fixed an error in eligibility checking
- Fixed an error in account activation
- Organized imports