Bom dia. Eu não entendi bem se devo usar ou não o construtor sem argumentos, criando a conexao automativamente? É correto eu criar um método estático pra gerenciar as instancias como no fonte abaixo? Eu sempre uso assim. Gostaria de saber se é uma boa pratica.
public class ProdutoDAO {
    private static ProdutoDAO instance;
    private Connection connection;
    public static ProdutoDAO getInstance() throws Exception {
        if (instance == null) {
            instance = new ProdutoDAO();
        }
        return instance;
    }
    public ProdutoDAO() throws Exception {
        this.connection = new ConnectionFactory().getConnection();
    }
    public void salvar(Produto produto) throws SQLException {
        String sql = "INSERT INTO PRODUTO(NOME, DESCRICAO) VALUES(?, ?)";
        try (PreparedStatement prepareStatement = this.connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
            prepareStatement.setString(1, produto.getNome());
            prepareStatement.setString(2, produto.getDescricao());
            prepareStatement.execute();
            try (ResultSet resultSet = prepareStatement.getGeneratedKeys()) {
                while (resultSet.next()) {
                    produto.setId(resultSet.getInt(1));
                }
            }
        }
    }
} 
            