Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Error doing a deleteorder method  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to have a method to delete an order, 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.

 
Bartender
Posts: 5283
55
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
 
marta roat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:What language is this? It is similar to Java but it isn't. Is it JavaScript?

its java ee
 
Master Rancher
Posts: 881
17
Firefox Browser Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do you need to loop all books if you have the book id.
If you need to remove the book from an order and increase the stock with one of the bookId's book that wouldn't be a single method but 2.
You're using hibernate? So why don't use a jpa repository
 
Marshal
Posts: 62172
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

The error message means you can only access an instance method/field from another instance method or similar.
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!