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 data source per tenant
* 1 data source extending Spring's AbstractRoutingDataSource using the value of 
a ThreadLocal variable as lookup key
* 1 single entity manager factory configured with the routing data source
* 1 single transaction manager
* etc

It mostly works but I am having caching issues with concurrent operations 
working on different tenants, so I was wondering: how can I extend the various 
OpenJPA (query, data, L1, L2, every one) caches to hold back different actual 
instances per tenant and to use the appropriate one depending on the same 
ThreadLocal value I have already used above for data sources?

Thanks in advance.
Regards.

[1] https://github.com/Cepr0/sb-multitenant-db-demo

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/

Reply via email to