Bonjour,

J'ai deux méthodes qui manipulent des HashMap ,la première(deleteVoyagesPrev) fait appel à la deuxième(findVoyageStatSupprById),cette dernière reçoit le résultat d'une requête Sql qui renvoit deux BigDecimal(min et max).

Le problème est que la HashMap a tjs la valeur null et je comprends pas pourqoui ?

Si vous pouvez m'aider,ça sera gentil de votre part.

Merci d'avance.

voici les codes:

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
 
public void deleteVoyagesPrev(ILieu origine, ILieu destination,
			String clientOrigine, String clientDestination, Date debutPeriode,
			Date finPeriode, int nombreASupprimer) throws DaoException {
		SqlMapClient sqlMap = SqlManager.getSqlMapInstance();
		Map<String, Object> map = new HashMap<String, Object>();
		Map<String, Object> minMaxMap= new HashMap<String, Object>();
		map.put("param", nombreASupprimer);
		if (origine != null)
			map.put("idLieuOrigine", origine.getIdLieu());
		if (destination != null) {
			map.put("idLieuDestination", destination.getIdLieu());
		}
		map.put("clientOrigine", clientOrigine);
		map.put("clientDestination", clientDestination);
		if (debutPeriode != null) {
			map.put("dateDebutPeriode", DateHelper.formatDate(debutPeriode));
		}
		if (finPeriode != null) {
			map.put("dateFinPeriode", DateHelper.formatDate(finPeriode));
		}
		try {
			 minMaxMap = findVoyageStatSupprById(origine,
					destination, clientOrigine, clientDestination,
					debutPeriode, finPeriode, nombreASupprimer);
			System.out.println("min : " + minMaxMap.get("min_id") + " max :"
					+ minMaxMap.get("max_id"));
			map.put("min", minMaxMap.get("min_id"));
			map.put("max", minMaxMap.get("max_id"));
			sqlMap.update("Voyage.deleteVoyageStat", map);
		} catch (SQLException e) {
			throw new DaoException(e);
		}
	}

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
 
 
public Map<String, Object> findVoyageStatSupprById(ILieu origine,
			ILieu destination, String clientOrigine, String clientDestination,
			Date debutPeriode, Date finPeriode, int nombreASupprimer)
			throws DaoException {
		SqlMapClient sqlMap = SqlManager.getSqlMapInstance();
		Map<String, Object> map = new HashMap<String, Object>();
		Map<String,Object> mapBidon=new HashMap<String, Object>();
		if (origine != null)
			map.put("idLieuOrigine", origine.getIdLieu());
		if (destination != null) {
			map.put("idLieuDestination", destination.getIdLieu());
		}
		map.put("clientOrigine", clientOrigine);
		map.put("clientDestination", clientDestination);
		if (debutPeriode != null) {
			map.put("dateDebutPeriode", DateHelper.formatDate(debutPeriode));
		}
		if (finPeriode != null) {
			map.put("dateFinPeriode", DateHelper.formatDate(finPeriode));
		}
		try {
			 mapBidon=(Map<String, Object>)(sqlMap.queryForObject(
					"Voyage.findVoyageStatSupprById", map));
			System.out.println("minbidon : " + mapBidon.get("min_id") + " maxbidon :"
					+ mapBidon.get("max_id"));
 
		} catch (SQLException e) {
			throw new DaoException(e);
		}
		return mapBidon;
	}
Cdt,