private static Commande mapRes(ResultSet rs) { Commande commande = new Commande(); try { commande.setId(rs.getInt("IDCOMMANDE")); commande.setClient(DaoClient.find(rs.getInt("IDCLIENT"))); commande.setAdresse(rs.getString("ADRESSECOMMANDE")); commande.setDate(rs.getTimestamp("TIMECOMMANDE")); commande.setEtat(Commande.stringToEnum(rs.getString("ETATCOMMANDE"))); } catch (Exception e) { e.printStackTrace(); } return commande; }
private static Commande mapRes(ResultSet rs, boolean withList) { if (!withList) { return mapRes(rs); } else { Commande commande = new Commande(); try { commande.setId(rs.getInt("IDCOMMANDE")); commande.setClient(DaoClient.find(rs.getInt("IDCLIENT"))); commande.setAdresse(rs.getString("ADRESSECOMMANDE")); commande.setDate(rs.getTimestamp("TIMECOMMANDE")); commande.setEtat(Commande.stringToEnum(rs.getString("ETATCOMMANDE"))); commande.setPlacoms(DaoPlaCom.findByCommande(commande.getId())); } catch (Exception e) { e.printStackTrace(); } return commande; } }