Can I execute multiple SQL queries in a single thread in Java?
I have ExecutorService service = Executors.newCachedThreadPool()
where I handle the user response. I have a very hard-coded sequence of code where I execute some SQL queries conditionally (I use CompletableFuture
with ExecutorService
for getting results asynchronously). I follow the principle of executing each sql query in a separate service.execute call but this time using CompletableFuture
for getting result from database makes code much harder to read and maintain.
Can I call multiple SQL queries in a single thread in Java?
I have ExecutorService service = Executors.newCachedThreadPool()
where I handle user response. I have a very hard-coded sequence of code where I do some SQL queries conditionally (I use CompletableFuture
with ExecutorService
for getting results asynchronously). I follow the principle of executing each sql query in a separate service.execute call but this time using CompletableFuture
for getting result from database makes code much harder to read and maintain.