@Override
    public void addBoats(ArrayList<Boat> boatList) throws SQLIntegrityConstraintViolationException, SQLException {
        theConnection.open();
        Connection conn = theConnection.getConn();
        try {
            int[] boatID = new int[boatList.size()];
            conn.setAutoCommit(false);

            for (int i = 0; i < boatList.size(); i++) {
                String STMT = "SELECT COUNT(*) FROM Bateau WHERE IdPartie = '" + boatList.get(i).getGame().getGameID() + "'";;
                Statement stmt = conn.createStatement();
                ResultSet rset = stmt.executeQuery(STMT);
                rset.next();
                boatID[i] = rset.getInt(1);
                rset.close();
                stmt.close();
                System.out.println("BOAT ID "+ boatID[i]);
                STMT = "INSERT INTO Bateau VALUES (" + boatID[i] + ",'" + boatList.get(i).getGame().getGameID() + "','" + boatList.get(i).getSize() + "','" + boatList.get(i).getOwner().getPseudo() + "','" + boatList.get(i).getPosX() + "','" + boatList.get(i).getPosY() + "','" + boatList.get(i).getOrientation() + "','" + boatList.get(i).getLife() + "','" + boatList.get(i).getPosXInit() + "','" + boatList.get(i).getPosYInit() + "','" + boatList.get(i).getNbCoupRestant() + "')";
                stmt = conn.createStatement();
                stmt.executeUpdate(STMT);
                stmt.close();
            }

            conn.commit();

            for (int i = 0; i < boatList.size(); i++) {
                boatList.get(i).setBoatID(boatID[i]);
            }

        } catch (SQLIntegrityConstraintViolationException e) {
            Logger.getLogger(JDBCUpdater.class.getName()).log(Level.SEVERE, null, e);
            conn.rollback();
            throw new SQLIntegrityConstraintViolationException();
        } catch (SQLException ex) {
            Logger.getLogger(JDBCUpdater.class.getName()).log(Level.SEVERE, null, ex);
            conn.rollback();
            throw new SQLException();
        } finally {
            conn.setAutoCommit(true);
            theConnection.close();

        }
    }