Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 49861 invoked from network); 6 Apr 2007 16:03:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2007 16:03:19 -0000 Received: (qmail 46588 invoked by uid 500); 6 Apr 2007 16:03:23 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 46574 invoked by uid 500); 6 Apr 2007 16:03:23 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 46563 invoked by uid 99); 6 Apr 2007 16:03:23 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 09:03:23 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of clamey@localmatters.com designates 216.241.189.144 as permitted sender) Received: from [216.241.189.144] (HELO mailhost01.ad.corp.localmatters.com) (216.241.189.144) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 09:03:15 -0700 Received: from 10.4.0.152 ([10.4.0.152]) by mailhost01.ad.corp.localmatters.com ([10.200.4.32]) with Microsoft Exchange Server HTTP-DAV ; Fri, 6 Apr 2007 16:02:54 +0000 Received: from dev02lt by webmail.localmatters.com; 06 Apr 2007 10:03:15 -0600 Subject: AbstractRoutingDataSource & cache From: Chris Lamey Reply-To: clamey@localmatters.com To: user-java@ibatis.apache.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Local Matters, Inc. Date: Fri, 06 Apr 2007 10:03:15 -0600 Message-Id: <1175875395.2707.10.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) X-Virus-Checked: Checked by ClamAV on apache.org Hello all, I'm looking at using Spring's new-ish AbstractRoutingDataSource to hit multiple DataSources with iBATIS. I think it'll work fine in terms of routing to the right DataSource via a ThreadLocal, but I'm concerned about the iBATIS caching mechanism. Specifically, it seems to me that if I have a single SqlMapClientFactoryBean with RoutingDataSource as the DataSource, the cache in the SqlMapClient won't know which 'real' DataSource the results came from and mix them all together. So if the databases in question have the same schemas and some overlapping OIDs, the cache would be messed up. Does that sound about right? Is there a way to avoid that other than not using cache? Is there a better way to use Spring and iBATIS with multiple DataSources? Thanks, Chris