Skip Navigation
Spring JPA Entity table name from request

I have multiple tables with the same schema. The only difference is the table name. Table names are in the format table_name_<tenant_id>, for example, table_name_1, table_name_24, table_name_15 etc.,

I want to use a single Entity and JPA repository to perform operations on this table. I get the tenant_id from the Request. I want to execute queries on the corresponding tables.

How do I dynamically set the table name to be used for querying?

We have only 5 such tables since the data for each tenant is very high

Not adding a MWE since I couldn't find any place to start trying approaches.

Edit: Replace user_id with tenant_id and add number of tables present

0
Has Jedi Survivor been patched for PC?

I was told that Jedi Survivor wasn't great on PC. Has it improved since its release? If I buy it now, can I play it without issues?

0
What are your thoughts on Visual Programming languages?

Do you think they can be powerful enough to build production-grade applications some day or are they going to stay as educational tools or build into specific applications forever?

4
BBloggsbott BBloggsbott @beehaw.org
Posts 3
Comments 0