source: ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/CatParametreDAOjdbc.java @ 68

Last change on this file since 68 was 68, checked in by cbipsl, 14 years ago

commit v1 eccad

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1package org.medias.eccad.persistance.jdbc;
2
3import java.sql.Connection;
4import java.sql.ResultSet;
5import java.sql.SQLException;
6import java.sql.Statement;
7import java.util.LinkedList;
8import java.util.List;
9
10import org.medias.eccad.helpers.LoggerPerso;
11import org.medias.eccad.modele.CatParametre;
12import org.medias.eccad.persistance.dao.CatParametreDAO;
13import org.medias.eccad.persistance.exception.PersistanceException;
14
15public 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}
Note: See TracBrowser for help on using the repository browser.