iBatis - 2.1.7.597
Spring - 2.0-m2
I have Spring configured to manage iBatis with the following:
<bean id="userTransaction" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/UserTransaction" />
</bean>
<!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
<!-- Necessary here due to the need for distributed transactions across two databases -->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransactionName" value="java:comp/env/UserTransaction"/>
</bean>
<!-- SqlMap setup for iBATIS Database Layer -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="WEB-INF/sql-map-config.xml"/>
</bean>
I have a CustomerBilling object that contains a Customer object and has a method signature to retrieve it as follows:
public Customer getCustomer()
When I load my CustomerBilling object I want to also load my Customer object, but the problem that I have is that the Customers table resides within a different database from the Addresses. (Don't ask me why, I did not design the data model I only inherited it.)
So now if I write my CustomerBilling SqlMap as follows:
<result column="customer_no" property="customer" select="Customer-findByPrimaryKey"/>
I will get an SQL exception because the same datasource is being used when the Customer-findByPrimaryKey statement is executed.
I really don't know if this can be resolved with configuration or if I will need to have an Observer on the CustomerBilling object that will load the Customer when accessed but I am open to suggestions to find a resolution to this problem.
Thanks for the help...
Chris Mathrusse
[EMAIL PROTECTED]
Sybase, Inc
One Sybase Drive
Dublin, CA 94568
(925) 236-5553
