public static boolean insertFlight(Flight f){
        boolean result = false;

        PreparedStatement pstmt;
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
            String date = sdf.format(f.getDate());

            pstmt = con.prepareStatement("INSERT INTO flight (flightnumber, airportfrom, airportdestination, pilot, copilot, `date`, plane) VALUES (?, ?, ?, ?, ?, ?, ?);");

            pstmt.setInt(1, f.getNumber());
            pstmt.setString(2, f.getFrom().getCode());
            pstmt.setString(3, f.getDestination().getCode());


            pstmt.setInt(4, f.getPilots()[0].getNumber());
            pstmt.setInt(5, f.getPilots()[1].getNumber());
            
            pstmt.setString(6, date);
            pstmt.setInt(7, f.getPlane().getNumber());

            int x = pstmt.executeUpdate();
            if (x == 1) {
                result = true;
            }

            pstmt = con.prepareStatement("SELECT LAST_INSERT_ID();");
            int id = f.getNumber();


            pstmt = con.prepareStatement("INSERT INTO `flightstaff` VALUES(?, ?);");
            pstmt.setInt(1, id);

            for(Staff s : f.getOtherPersonal()){
                pstmt.setInt(2, s.getNumber());
                pstmt.executeUpdate();
            }


            pstmt = con.prepareStatement("INSERT INTO `flightstops` VALUES(?, ?);");
            pstmt.setInt(1, id);

            for(Airport a : f.getStops()){
                pstmt.setString(2, a.getCode());
                pstmt.executeUpdate();
            }
            
         } catch (SQLException ex) {
             System.out.println(""+ex.getMessage());
            Logger.getLogger(DatabaseConnectie.class.getName()).log(Level.SEVERE, null, ex);
            try {
                con.rollback();
            } catch (SQLException ex1) {
                Logger.getLogger(DatabaseConnectie.class.getName()).log(Level.SEVERE, null, ex1);
            }
        }

        return result;
    }