public void insertSale(Customer c) throws SQLException { int id = c.getId(); String name = c.getName(); String address = c.getAddress(); String phone = c.getPhoneNumber(); String cardType = c.getCardType(); String cardNumber = c.getCardNumber(); String cardExp = c.getCardExp(); String secCode = c.getSecCode(); String cartDetails = ""; for (Product p : c.getCart().getProductList()) cartDetails += p.getName() + "@" + p.getUnitPrice() + "x" + p.getQuantity() + " "; BigDecimal cartTotal = c.getCart().getTotal().setScale(2); Statement stmt = con.createStatement(); String sql = "INSERT INTO App.SALES VALUES(" + id + ",'" + name + "','" + address + "','" + phone + "','" + cardType + "','" + cardNumber + "','" + cardExp + "','" + secCode + "','" + cartDetails + "'," + cartTotal + ",'" + getCurrentTimeStamp() + "')"; stmt.executeUpdate(sql); }