diff --git a/doc/reference/src/dbprovider.xml b/doc/reference/src/dbprovider.xml index e03ddb47..087f83ab 100644 --- a/doc/reference/src/dbprovider.xml +++ b/doc/reference/src/dbprovider.xml @@ -477,13 +477,43 @@ is configured using the dictionary property TargetDbProviders. The key of this dictionary contains the name of a dbProvider and its value is a dbProvider object. - (You can also provide this dictionary as a constructor argument.) During - request processing, once you have determined which target dbProvider - should be use, in this example database1ProviderName, you should execute - the following code - LogicalThreadContext.SetData("dbProviderName", - "database1ProviderName") and then call the data access - layer. + (You can also provide this dictionary as a constructor argument.) +During request processing, once you have determined which target + dbProvider should be use, in this example database1ProviderName, you + should execute the following code is you are using Spring 1.2 M1 or + later + + // Spring 1.2 M1 or later + +LogicalThreadContext.SetData(MultiDelegatingDbProvider.CURRENT_DBPROVIDER_SLOTNAME, "database1ProviderName") + + and the following ocde if you are using earlier versions + + // Prior to Spring 1.2 M1 + +LogicalThreadContext.SetData("dbProviderName", "database1ProviderName") + + and then call the data access layer. + + Here is a sample configuration to build up an object definition + for MultiDelegatingDbProvider. + + <db:provider id="CreditAndDebitsDbProvider" + provider="System.Data.SqlClient" + connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=CreditsAndDebits;User ID=springqa; Password=springqa"/> + +<db:provider id="CreditDbProvider" + provider="System.Data.SqlClient" + connectionString="Data Source=MARKT60\SQL2005;Initial Catalog=Credits;User ID=springqa; Password=springqa"/> + +<object id="dbProviderDictionary" type="Spring.Collections.SynchronizedHashtable, Spring.Core"> + <property name="['DbProvider1']" ref="CreditAndDebitsDbProvider"/> + <property name="['DbProvider2']" ref="CreditDbProvider"/> +</object> + +<object id="DbProvider" type="Spring.Data.MultiDelegatingDbProvider, Spring.Data"> + <property name="TargetDbProviders" ref="dbProviderDictionary"/> +</object>