1 | package org.medias.eccad.persistance.jdbc; |
---|
2 | |
---|
3 | import java.sql.Connection; |
---|
4 | import java.sql.ResultSet; |
---|
5 | import java.sql.SQLException; |
---|
6 | import java.sql.Statement; |
---|
7 | import java.util.LinkedList; |
---|
8 | import java.util.List; |
---|
9 | |
---|
10 | import org.medias.eccad.helpers.LoggerPerso; |
---|
11 | import org.medias.eccad.modele.CatParametre; |
---|
12 | import org.medias.eccad.persistance.dao.CatParametreDAO; |
---|
13 | import org.medias.eccad.persistance.exception.PersistanceException; |
---|
14 | |
---|
15 | public class CatParametreDAOjdbc extends GeneriqueDAOjdbc implements CatParametreDAO{ |
---|
16 | |
---|
17 | public CatParametreDAOjdbc(SGBD_jdbc sgbd) { |
---|
18 | super (sgbd); |
---|
19 | } |
---|
20 | |
---|
21 | public CatParametreDAOjdbc() { |
---|
22 | super(); |
---|
23 | } |
---|
24 | |
---|
25 | |
---|
26 | public List<CatParametre> getListcatParametre() throws PersistanceException { |
---|
27 | Connection conn = null; |
---|
28 | Statement requete; |
---|
29 | String sql; |
---|
30 | List<CatParametre> liste_catParam = new LinkedList<CatParametre>(); |
---|
31 | ResultSet resultat = null; |
---|
32 | |
---|
33 | conn = getConnection(); |
---|
34 | |
---|
35 | try {LoggerPerso.log(CatParametreDAOjdbc.class, LoggerPerso.DEBUG, "DAOjdbc youhou!!"); |
---|
36 | requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
---|
37 | sql = "select distinct id_categorieparametre, fullname_categorieparametre from categorieparametre join parametre using (id_categorieparametre) join grille using (id_param);"; |
---|
38 | |
---|
39 | resultat = requete.executeQuery(sql); |
---|
40 | |
---|
41 | |
---|
42 | while (resultat.next()) { |
---|
43 | liste_catParam.add(new CatParametre(resultat.getInt("id_categorieparametre"), resultat.getString("fullname_categorieparametre"))); |
---|
44 | } |
---|
45 | } |
---|
46 | catch (SQLException sqle){ |
---|
47 | throw new PersistanceException(sqle, "erreur lors de la requete :: CatParametreDAOjdbc.getListParametre"); |
---|
48 | } |
---|
49 | finally { |
---|
50 | closeConnection(); |
---|
51 | } |
---|
52 | |
---|
53 | LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListCatParametre::taille::"+liste_catParam.size()); |
---|
54 | |
---|
55 | return liste_catParam; |
---|
56 | } |
---|
57 | |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | |
---|
62 | } |
---|