Can hibernate wait for a record to be present in database before executing?

Viewed 93

I have recently started using hibernate for database testing and come across a scenario where after an API POST request, it can take circa 15 - 25 mins for records to be created in the database. My script sends the request using ReasAssred, it then immediately connects to the database using hibernate to run a query which searches the records generated from the request.

With the help of Java's TimeUnit.MINUTES.sleep(25), hibernate waits for the record to be present in the table before sending a query, however, sometimes the record can be generated in about 15 mins. Of course, hibernate won't proceed until the 25 mins lapse.

I'm curious. Does hibernate have a smart or fluent way of checking the table at intervals and then execute the query once the data is available, instead of waiting the whole 25 mins? Is there a better way to handle the scenario rather than a dumb 25 mins sleep? I have done ample research online without any concrete resolution, hence this question.

0 Answers
Related