Bonjour,
J'aimerais charger le contenu d'un menu déroulant à partir d'une requête SELECT. J'utilise le modele DAO , et la librairie JSTL.
Lorsque que j'execute ma requete qui est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 public List<Articles> chargementListArticlesFamille() throws DAOException { // TODO Auto-generated method stub // Implémentation de la méthode définie dans l'interface ArticleDao Connection connexion = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; Articles article = null; Statement statement = null; try { // Récupération d'une connexion depuis la Factory connexion = daoFactory.getConnection(); System.out.println("execution de la requete SQL !"); System.out.println("Requete :"+SQL_SELECT_PAR_FAMILLE); preparedStatement = initialisationRequetePreparee( connexion, SQL_SELECT_PAR_FAMILLE, false ); statement = connexion.createStatement(); resultSet = preparedStatement.executeQuery(); // Parcours de la ligne de données de l'éventuel ResulSet retourné articlesFam.clear(); while ( resultSet.next() ) { //Voir probleme resultSet pour recherche Famille article = map( resultSet ); articlesFam.add(article); } } catch ( SQLException e ) { System.out.println("erreur dans la requete !"); System.out.println("erreur"+e.getMessage()); throw new DAOException( e ); } finally { System.out.println("fermeture de la connection !"); fermeturesSilencieuses( resultSet, preparedStatement, connexion ); } return articles; }
J'obtiens ce message d'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part private static final String SQL_SELECT_PAR_FAMILLE = "SELECT DISTINCT A.A1FAM FROM PGVMARTM A";
Pouvez vous me dire d'où cela proviens, je prècise que je n'ai jusqu'à mettre le RESULTSET en commentaire pour ne plus avoir d'erreur mais evidemment je n'ai rien en resultat de ma requete...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 Requete :SELECT DISTINCT A.A1FAM FROM PGVMARTM A erreur dans la requete ! erreurAn undefined column name was detected. fermeture de la connection ! 5 avr. 2013 13:53:28 org.apache.catalina.core.StandardWrapperValve invoke GRAVE: "Servlet.service()" pour la servlet AfficheArticles a généré une exception org.omega.dao.DAOException: java.sql.SQLException: An undefined column name was detected. at org.omega.dao.ArticleDaoImpl.chargementListArticlesFamille(ArticleDaoImpl.java:184) at org.omega.forms.RechercheArticleForm.rechercheListArticleFamille(RechercheArticleForm.java:48) at org.omega.servlets.AfficheArticles.doGet(AfficheArticles.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) Caused by: java.sql.SQLException: An undefined column name was detected. at com.ibm.as400.access.JDError.throwSQLException(JDError.java:408) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:380) at com.ibm.as400.access.JDServerRow.findField(JDServerRow.java:482) at com.ibm.as400.access.AS400JDBCResultSet.findColumn(AS400JDBCResultSet.java:557) at com.ibm.as400.access.AS400JDBCResultSet.getString(AS400JDBCResultSet.java:3394) at org.omega.dao.ArticleDaoImpl.map(ArticleDaoImpl.java:32) at org.omega.dao.ArticleDaoImpl.chargementListArticlesFamille(ArticleDaoImpl.java:176) ... 20 more
Merci d'avance.
Partager