I'm just getting started on a spring app that is currently using spring data with a jpa repository. I'm planning on the app being a multi-tenant app using a single database schema. What I'm trying to figure out is the best way to attach the tenant id to each query. Of course I can write each query in the repository to expect a tenant id parameter and grab the tenant id out of a thread local or similar, but I was wondering if there was a better technique that is commonly used in this situation? Maybe there is a more declarative way to do it that I haven't come across yet.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.