hi everyone,
we are currently working on an application which switches the datasource by loging in according to the users organisation.
the switching is done via HotSwappableTargetSource with one sessionfactory and seems to work fine (all sources have same schema).
After all we tried to enable ehcache for hibernate and ran into a small issue.
1. i try to get com.example.domain.UserEO with id#1 from datasource A
2. i try to get com.example.domain.UserEO with id#1 from datasourceB
Result: instead of querying the second userEO, ehCache gives me the result from the cache:
Code:
Cache lookup: com.example.domain.UserEOImpl#1
Cache hit: com.example.domain.UserEOImpl#1
[without enabled cache the results come from both datasources...]
so my questions are..
is there any possibillity to modify the cacheKey in order to differ both queries?
is it ok for hibernate to switch between the datasources, or are there some known issues?
i would be grateful for any expiriences or solutions..
thanks in advance!!
elmar
by the way - we are using
hibernate 3.1.3
spring 2.0.2
ehcache 1.2.3