Is there a way that I can get JPA (Eclipselink specifically) to dynamically select a connection pool depending on some property bound to the current thread?
The problem I'm trying to solve is scaling a multitenant system, where tenants may be split up over several DB instances. Each DB instance will be multitenant, but to scale, I may not be able to fit all tenants in one DB instance comfortably.
I am familiar with @Multitenant
to support single-table multitenancy, and have successfully used Eclipselink session event callbacks to set values in the Eclipselink Session
dynamically. I'm trying to take the next step of changing the DataSource
that the EntityManager will be using, so I don't have to necessarily use a clustered DB.
Thanks!