Using different data sources for specific requests with Spring and IBATIS
1 answer
We did this by creating two SqlMapClients, one for reading and one for reading / writing. Each one has its own sqlMapConfig file. We split our sqlMap resources into read and write pairs, i.e. Account.xml and Account-Write.xml. Read-only sqlMapConfig loads read-only sqlMap resources, and sqlMapConfig read-write loads both read and write resources.
It seems to be good. If you are in a read-only transaction, you are using a read-only SqlMapClient, otherwise you are using a read-write SqlMapClient.
+3
source to share