This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services 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
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Flush old data and make query for a new data  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! It's my first topic)

Spring Data JPA | Hibernate

In a nutshell, I get data from one table, do some stuff like inserting or updating data in the bounded tables. Try to fetch data from the first table, but spring returns me old data.

In details.
In my controller I fetch order:


Then I get order products:


I have amount of specific product from HTTP request.
Update order's product amount :


It's okay, I updated amount of product, but I need to count and update total price of order. I try to get order with assosiated products again in another method, but i get old data:


Full code of class is here: https://github.com/VitaliyGoncharov/AutoSupplies/blob/master/server/src/main/java/com/carssps/controller/manager/OrderController.java

How to tell spring that data was changed and i need to flush old data and fetch new?

 
David Belcher
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did wrong search requests in google. I found a solution. I added

to controller method updateTotal() right before fetching data one more time.
 
Ranch Hand
Posts: 82
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I viewed your source code and was impressed.
Is this a tutorial you are following?
If so, would you share the link?
 
David Belcher
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Nachreiner wrote:I viewed your source code and was impressed.
Is this a tutorial you are following?
If so, would you share the link?


Thank you!
No, I don't use any specific tutorial. It's my first project on java. I google almost everything that I don't know. Stackoverflow, baeldung, etc.
 
Tim Nachreiner
Ranch Hand
Posts: 82
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What tool are you using to develop the Angular piece?
 
David Belcher
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Nachreiner wrote:What tool are you using to develop the Angular piece?


I use visual studio code!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!