I need to do a deleteorder method, my idea is to compare all the books that the shop has with the books that are in the order, and then increase the quantity in the stock and remove the order.
I have an error doing a loop with all the books that there are in the shop, the error is "non-static method getBooks() cannot be referenced from a static context" and I dont know to solve it.
ublic void deleteOrder(Customer customer, long idOrder){ for (int i=0; i<=customer.getOrders().size(); i++){ if(customer.getOrders().get(i).size()==idOrder){ for(int j=0; j<=SessionMB.getBooks().size(); j++){ #here is the error #### public List<Books> getBooks(){ return listBooks.allBooks(); #### public List<Books> allBooks(){ TypedQuery<Books> query=em.createQuery("SELECT m FROM books m", books.class); return query.getResultList(); #### public void incStock(int quantity) { stock += quantity; }