-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in OrderController.java #3
Comments
@AlpNek are you sure you have all the model code correctly available when you are building. The getProductPrice() is a simple getter in the Product class. Once the repository method returns an instance of a product by id we are simply calling the getter so it should work. Also you said OrderController I think that's a typo it is OrdersController. |
Hi @shakeelosmani , thanks for replying promptly. I found this comment on your blog and realised the error is because of newer version of springframework: So changed the code to: Cheers. |
I see yeah that makes sense. Usually I think people would use the pom file and download dependencies that way it will work but downloading later versions may or may not work as I have not kept up with the updates in this example. And the updated code looks fine but it would be better to wrap it in a try catch as it could return null and then a possible exception |
Thanks @shakeelosmani ! I'll test with try ... catch instead of checking for isNaN () which I'm sure will fall at some point. |
Hi,
Trying to learn some Java + Spring + stuff and your example is awesome.
However, I see an error when using the OrderController.java code. On line 60, it tells me:
Cannot resolve method 'getProductPrice()
Due to this, not able to continue with build.
The text was updated successfully, but these errors were encountered: