Hi there,
at Syncope we have been implementing multi-tenancy by relying on something like:
* 1 data source per tenant
* 1 entity manager factory per tenant
* 1 transaction manager per tenant
* etc
So far so good.
Now I am experimenting a different approach similar to [1], e.g.
* 1 low-level da
Hi Francesco,
Normally if you have one EMF per tenant there is no leak between them since
the cache instance is stored in the EMF - used that approach in TomEE.
You can check it
in org.apache.openjpa.datacache.DataCacheManagerImpl#initialize of each emf
which should be different.
So overall if th
Hi Romain,
see my replies embedded below.
Regards.
On 08/01/24 17:43, Romain Manni-Bucau wrote:
Hi Francesco,
Normally if you have one EMF per tenant there is no leak between them since the
cache instance is stored in the EMF - used that approach in TomEE.
As I am saying below, this is what
Hi Francesco,
While you have an EMF router you don't have pitfall 4, it only happens if
your routing is done at datasource level but it also means you have way
more side effects and you start to loose the hability to tune per tenant (a
common pattern is to tune the cache per tenant "size"/usage, t
Thank Romain, I share your considerations and concerns below, and also agree
that EMF routing is the way to go.
I probably need to tune my current exploration to let evolve what we currently
have in Syncope towards proper EMF routing.
Do you have any sample I could follow about that?
Regards.
Don't have everything ready for spring-data but had something like that in
mind:
public class RoutedEMFConf {
@Bean
@Primary
LocalContainerEntityManagerFactoryBean
mainEntityManagerFactory(final Tenant tenant, final ApplicationContext
context) {
final var emfs = findDelegates(
FYI, I've adopted a similar solution: still a few things to iron, but globally
it works.
Thank you.
Regards.
On 09/01/24 11:58, Romain Manni-Bucau wrote:
Don't have everything ready for spring-data but had something like that in
mind:
public class RoutedEMFConf {
@Bean
@Primary