I'm writing a RESTful web service using spring boot. For some computations could be useful load input data into a table of an in memory database (e.g. Hsqldb) and do some aggregations and calculus. But the created table must have a request scope, created and populated on every request.
Is there a way to achieve this pattern using Spring Data or Spring jpa?
I've tried to use @RequestScope annotation on repository interface. I wrote multiple Junit test classes to verify if entities are added on the same table.
Regards
You would need to create, populate, calculate & drop a table that is named uniquely per request by appending a UUID. I don't think JPA will allow dynamic table names but JDBC can be used.
I suspect that your problem is better solved with stream aggregations.