views:

28

answers:

1

I am working on a project in which we need to define agencies in other cities. We have the same application but separate database schema for each agency. I used one session factory. For each request we get the person's username and therefore we can recognize which agency they belongs to. We change the PostgreSQL search_path for that.

The problem is now with cache. Since we are changing schema constantly it seems cache does not work.

Our jobs (which are written with quartz scheduling) seem to have problem because we are changing schema constantly.

Any ideas?

A: 

Can you not use a session factory per schema?

Preet Sangha
well,no. i wanted to do that at first but when the number of agencies increases defining so many session factories will cost so much.for cache i decided to change updating schema per connection instead of per session .and that solved the problem of cache.but i am still concerned a bout "quartz's job" and whether changing schema constantly will result in a fatal problem or not.
Niloofar