Hi,
I'd like to know whether it is possible to configure an SQL Datasource to perform its fetch operation using the same database connection/transaction as a Service and a Dao that are configured using Spring transaction manager.
Below is a pseudo code that describes what I tried but it didn't work.
The Dao has to insert some rows into a temporary table (without committing them) and those rows should be visible by the SQL Datasource fetch query.
I'm using Spring 3 and SmartGWT 2.5.2011-05-14-EVAL.
I'd like to know whether it is possible to configure an SQL Datasource to perform its fetch operation using the same database connection/transaction as a Service and a Dao that are configured using Spring transaction manager.
Below is a pseudo code that describes what I tried but it didn't work.
The Dao has to insert some rows into a temporary table (without committing them) and those rows should be visible by the SQL Datasource fetch query.
Code:
<context:annotation-config /> <tx:annotation-driven transaction-manager="transactionManager" /> <context:component-scan base-package="xxx" /> package xxx; public class MyDatasourceDMI { private MyDao dao; @Transactional(propagation = Propagation.REQUIRED) public DSResponse fetch(DSRequest dsRequest) throws Exception { dao.insertDataInTempTable(params); return dsRequest.execute(); } } <DataSource ID="myDatasource" serverType="sql" dbName="db" tableName="db-table"> <fields>field1... </fields> <operationBindings> <operationBinding operationType="fetch" serverMethod="fetch" autoJoinTransactions="true"> <serverObject lookupStyle="spring" bean="MyDatasourceDMI"/> <tableClause>..</tableClause> <selectClause>...</selectClause> <whereClause>...and exists (select 1 from temp_table where field1=col1)</whereClause> </operationBinding> </operationBindings> </DataSource>
Comment