public Reclamation(int idReclamation) throws Exception{
		db = new DbConnection();
		this.idReclamation = idReclamation;
		
		try {
			  //appel de la PS  get_reclamation_by_id 
				String sql = db.PrepareStoredProcedure("get_reclamation_by_id", 6);
				CallableStatement call = DbConnection.getConn().prepareCall(sql);
				if(call == null)
				{
					System.out.println("Call is null");
				}
				call.setInt(1, idReclamation);
				call.registerOutParameter(2,java.sql.Types.INTEGER);
				call.registerOutParameter(3, java.sql.Types.VARCHAR);
				call.registerOutParameter(4,
java.sql.Types.DATE);
				call.registerOutParameter(5,java.sql.Types.DATE);
				call.registerOutParameter(6,java.sql.Types.INTEGER);
				if(!call.execute())
				{	//traitement si OK
					this.employe= new Employe(call.getInt(2));
					this.description = call.getString(3);
					this.dtReclamation = call.getDate(4);
					this.dtCloture = call.getDate(5);
					this.priorite = call.getInt(6);
				}
				
		} catch (SQLException e) {
			
			System.out.print("erreur SQL");
			e.printStackTrace();
		}
		
		
	}
			
		
 
	
Partager