0

I have two services in Spring boot. From the main service i am calling another service which insert a row in the DB as following:

repo.saveAndFlush(payment);

As soon as the child service finishes its work in the main service i didn't get the updated response using following query:

repo.findOne(id);

Its all happening synchronously. I want to get all the rows using findOne() method including newly inserted row.

Any help is appreciated.

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
Awadesh
  • 3,530
  • 2
  • 20
  • 32

1 Answers1

0

Usually JpaRepository save methods return the newly saved data. So you can simply get the newly inserted row by doing something like this -

payment = repo.saveAndFlush(payment);