@Transactional and Saving to Database with Sleep

I am really new to SpringBoot and was asked to work on an 8 year old project. I was trying to integrate some AI stuff into it. I have a Controller that takes in data from a form from an API. I collect the data in the Controller, send it to a service class and insert the data into the DB using methods in the Service class.

The problem is, even after annotating all the methods with Transactional, all the transactions are only going through when I include a 5 second sleep in between each method that saves to the database. Otherwise only some or none of the inserts are working.

Could someone please help me with this?

I can't share the code unfortunately due to confidentiality reasons :(.