-
Jul 24th, 2007, 09:23 AM
#1
Modifying cacheKey for multiple datasources via interceptor
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:
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 possible to use setCacheRegion via spring interceptor?
so the cache key could be modified according to the used datasource....
or am i getting things completly wrong?
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules