ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher.Mathru...@sybase.com
Subject Re: Transactions across multiple datasources / Resin
Date Thu, 09 Mar 2006 20:16:19 GMT

<br><font size=2 face="sans-serif">Yes I do have experience with this.
I've implemented iBatis allowing Spring to be utilized as the framework
and transaction management system utilizing an external Transaction Manager.
It took a while for me to find all of the pieces so I hope this will help
you.</font>
<br>
<br><font size=2 face="sans-serif">I'm using Tomcat 5.5 as my container
so you will need to create a context.xml file with the similar entries
and place it in your META-INF directory of your application. I'm also using
JOTM as my transaction manager. You can download it freely at www.objectweb.com.</font>
<br>
<br><font size=2 face="sans-serif"><b><u>Tomcat context.xml configuration
file:</u></b></font>
<br><font size=2 color=blue>&lt;</font><font size=2 color=#800000>Context</font><font
size=2 color=red>
</font><font size=2 color=blue>&gt;</font>
<br><font size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
</font>
<br><font size=2 color=#808080>&nbsp; &nbsp; &nbsp; &nbsp; Your
Datasources that are to be used.</font>
<br><font size=2 color=#808080>&nbsp; &nbsp; &nbsp; &nbsp; Replace
the driver class, URL, user name and password with your specific entries</font>
<br><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>Resource</font><font
size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>jdbc/datasource1</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
auth</font><font size=2 color=blue>=&quot;</font><font size=2>Container</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
type</font><font size=2 color=blue>=&quot;</font><font size=2>javax.sql.XADataSource</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>org.objectweb.jndi.DataSourceFactory</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>com.sybase.jdbc3.jdbc.SybXADataSource</font><font
size=2 color=blue>&quot;
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>jdbc:sybase:Tds:SERVER1:dbPort/dbName</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;dbUser&quot;</font><font size=2 color=red>
password</font><font size=2 color=blue>=&quot;</font><font size=2>dbPassword</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
maxActive</font><font size=2 color=blue>=&quot;</font><font size=2>30</font><font
size=2 color=blue>&quot;</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>4</font><font size=2
color=blue>&quot;</font><font size=2 color=red>
timeout</font><font size=2 color=blue>=&quot;</font><font size=2>360</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
defaultAutoCommit</font><font size=2 color=blue>=&quot;</font><font
size=2>false</font><font size=2 color=blue>&quot;</font><font
size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>true</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>Resource</font><font
size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>jdbc/datasource2</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
auth</font><font size=2 color=blue>=&quot;</font><font size=2>Container</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
type</font><font size=2 color=blue>=&quot;</font><font size=2>javax.sql.XADataSource</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>org.objectweb.jndi.DataSourceFactory</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>com.sybase.jdbc3.jdbc.SybXADataSource</font><font
size=2 color=blue>&quot;
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>jdbc:sybase:Tds:SERVER2:dbPort/dbName</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;dbUser&quot;</font><font size=2 color=red>
password</font><font size=2 color=blue>=&quot;</font><font size=2>dbPassword</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
maxActive</font><font size=2 color=blue>=&quot;</font><font size=2>30</font><font
size=2 color=blue>&quot;</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>4</font><font size=2
color=blue>&quot;</font><font size=2 color=red>
timeout</font><font size=2 color=blue>=&quot;</font><font size=2>360</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
defaultAutoCommit</font><font size=2 color=blue>=&quot;</font><font
size=2>false</font><font size=2 color=blue>&quot;</font><font
size=2 color=red>
</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>=&quot;</font><font size=2>true</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
</font>
<br><font size=2 color=#808080>&nbsp; &nbsp; &nbsp; &nbsp; JOTM
as your Transaction manager</font>
<br><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp;</font><font size=2 color=blue>&lt;</font><font
size=2 color=#800000>Transaction</font><font size=2 color=red>
factory</font><font size=2 color=blue>=&quot;</font><font size=2>org.objectweb.jotm.UserTransactionFactory</font><font
size=2 color=blue>&quot;</font>
<br><font size=2 color=red>&nbsp; &nbsp; &nbsp; &nbsp;jotm.timeout</font><font
size=2 color=blue>=&quot;</font><font size=2>360</font><font size=2
color=blue>&quot;/&gt;</font>
<br><font size=2 color=blue>&lt;/</font><font size=2 color=#800000>Context</font><font
size=2 color=blue>&gt;</font>
<br>
<br><font size=2 face="sans-serif"><b><u>Spring configuration follows
and
should be defined within the application.xml file:</u></b></font>
<br><font size=2 color=blue>&lt;</font><font size=2 color=#800000>beans</font><font
size=2 color=red>
xmlns</font><font size=2 color=blue>=&quot;</font><font size=2>http://www.springframework.org/schema/beans</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
xmlns:xsi</font><font size=2 color=blue>=&quot;</font><font size=2>http://www.w3.org/2001/XMLSchema-instance</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
xmlns:aop</font><font size=2 color=blue>=&quot;</font><font size=2>http://www.springframework.org/schema/aop</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
xmlns:tx</font><font size=2 color=blue>=&quot;</font><font size=2>http://www.springframework.org/schema/tx</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
xmlns:jndi</font><font size=2 color=blue>=&quot;</font><font size=2>http://www.springframework.org/schema/jndi</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
xsi:schemaLocation</font><font size=2 color=blue>=&quot;</font><font
size=2>http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/jndi
http://www.springframework.org/schema/jndi/spring-jndi.xsd http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd</font><font size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
Main JNDI DataSource for J2EE environments </font><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;d</font><font size=2>ataSource</font><font
size=2 color=blue>1&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.jndi.JndiObjectFactoryBean</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>jndiName</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
value</font><font size=2 color=blue>=&quot;</font><font size=2>java:comp/env/jdbc/datasource1</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;d</font><font size=2>ataSource</font><font
size=2 color=blue>2&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.jndi.JndiObjectFactoryBean</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>jndiName</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
value</font><font size=2 color=blue>=&quot;</font><font size=2>java:comp/env/jdbc/datasource2</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
The reference to the Transaction Manager</font><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>transactionManager</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.transaction.jta.JtaTransactionManager</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>userTransactionName</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
value</font><font size=2 color=blue>=&quot;</font><font size=2>java:comp/UserTransaction</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;!--</font><font size=2 color=#808080>TRANSACTION
INTERCEPTOR</font><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>matchAllTxInterceptor</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.transaction.interceptor.TransactionInterceptor</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>transactionManager</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;</font><font
size=2 color=#800000>ref</font><font size=2 color=red>
bean</font><font size=2 color=blue>=&quot;</font><font size=2>transactionManager</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;/</font><font size=2
color=#800000>property</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>transactionAttributes</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;</font><font
size=2 color=#800000>props</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>prop</font><font size=2 color=red>
key</font><font size=2 color=blue>=&quot;</font><font size=2>insert*</font><font
size=2 color=blue>&quot;&gt;</font><font size=2>PROPAGATION_REQUIRED</font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>prop</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>prop</font><font size=2 color=red>
key</font><font size=2 color=blue>=&quot;</font><font size=2>update*</font><font
size=2 color=blue>&quot;&gt;</font><font size=2>PROPAGATION_REQUIRED</font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>prop</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>prop</font><font size=2 color=red>
key</font><font size=2 color=blue>=&quot;</font><font size=2>delete*</font><font
size=2 color=blue>&quot;&gt;</font><font size=2>PROPAGATION_REQUIRED</font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>prop</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>prop</font><font size=2 color=red>
key</font><font size=2 color=blue>=&quot;</font><font size=2>*</font><font
size=2 color=blue>&quot;&gt;</font><font size=2>PROPAGATION_REQUIRED,readOnly</font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>prop</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;/</font><font
size=2 color=#800000>props</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;/</font><font size=2
color=#800000>property</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>autoProxyCreator</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>interceptorNames</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;</font><font
size=2 color=#800000>list</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>idref</font><font size=2 color=red>
local</font><font size=2 color=blue>=&quot;</font><font size=2>matchAllTxInterceptor</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;/</font><font
size=2 color=#800000>list</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;/</font><font size=2
color=#800000>property</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>beanNames</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;</font><font
size=2 color=#800000>list</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>value</font><font size=2 color=blue>&gt;</font><font
size=2>*Dao</font><font size=2 color=blue>&lt;/</font><font size=2
color=#800000>value</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </font><font size=2 color=blue>&lt;/</font><font
size=2 color=#800000>list</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;/</font><font size=2
color=#800000>property</font><font size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
SqlMap setup for iBATIS Database Layer </font><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>1&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.orm.ibatis.SqlMapClientFactoryBean</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>configLocation</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
value</font><font size=2 color=blue>=&quot;</font><font size=2>WEB-INF/conf/sql-map-config1.xml</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>dataSource</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
ref</font><font size=2 color=blue>=&quot;</font><font size=2>dataSource1</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>2&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>org.springframework.orm.ibatis.SqlMapClientFactoryBean</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>configLocation</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
value</font><font size=2 color=blue>=&quot;</font><font size=2>WEB-INF/conf/sql-map-config2.xml</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>dataSource</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
ref</font><font size=2 color=blue>=&quot;</font><font size=2>dataSource2</font><font
size=2 color=blue>&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;!--</font><font size=2 color=#808080>
========================= DAO DEFINITIONS: IBATIS IMPLEMENTATIONS =========================
</font><font size=2 color=blue>--&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>currencyDao</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>com.yourCompany.dao.impl.CurrencyDaoImpl</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
ref</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>1&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;</font><font size=2 color=#800000>bean</font><font
size=2 color=red>
id</font><font size=2 color=blue>=&quot;</font><font size=2>countryDao</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
class</font><font size=2 color=blue>=&quot;</font><font size=2>com.yourCompany.dao.impl.CountryDaoImpl</font><font
size=2 color=blue>&quot;&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;
&nbsp; </font><font size=2 color=blue>&lt;</font><font size=2
color=#800000>property</font><font size=2 color=red>
name</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>&quot;</font><font size=2 color=red>
ref</font><font size=2 color=blue>=&quot;</font><font size=2>sqlMapClient</font><font
size=2 color=blue>2&quot;/&gt;</font>
<br><font size=2>&nbsp; &nbsp; &nbsp; &nbsp; </font><font
size=2 color=blue>&lt;/</font><font size=2 color=#800000>bean</font><font
size=2 color=blue>&gt;&lt;/</font><font size=2 color=#800000>beans</font><font
size=2 color=blue>&gt;</font>
<br>
<br><font size=2 face="sans-serif">Now all that you need to do is implement
your Sql Maps and your Doa's, making certain that the entries in your configuration
files point to the correct classes. All the real work is handled by Spring
including the transaction demarcation. When you start working with multiple
data sources they must participate in a global transaciton. The above configuration
demostrates this. </font>
<br>
<br><font size=2 face="sans-serif">I hope this helps....</font>
<br>
<br><font size=2 face="sans-serif"><br>
Chris Mathrusse<br>
christopher.mathrusse@sybase.com<br>
Sybase, Inc<br>
One Sybase Drive<br>
Dublin, CA 94568<br>
(925) 236-5553</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Reuben Firmin &lt;reuben.firmin@cnet.com&gt;</b>
</font>
<p><font size=1 face="sans-serif">03/09/2006 11:31 AM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
user-java@ibatis.apache.org</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">ibatis &lt;user-java@ibatis.apache.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Transactions across multiple
datasources / Resin</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2><tt>Hello,<br>
<br>
Has anybody applied transaction rules across multiple datasources using
<br>
Resin/Spring/Ibatis? I'm looking at the JtaTransactionManager that <br>
spring provides, which seems like it'll work, and will be experimenting
<br>
with that today. If you have practical examples of setting this up, <br>
though, I'd appreciate it.<br>
<br>
Thanks<br>
Reuben<br>
<br>
</tt></font>
<br>

Mime
View raw message