I have a Java EE application in which the user performs a series of actions over many pages in a linear direction. On one of the first pages I have the details needed to perform a database query, of which the result is required on one of the last. I do not want to make the user to wait for this database query to execute between pages, instead I want to run it in the background whilst the user is continuing.
What is the best way of doing this?
I know use of threads in a Java EE application is discouraged.