Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Isomorphic
    replied
    At the moment there doesn't appear to be a way to do this unless you did something exotic like setup a JNDI connection on the fly. However, in the latest SDK, you'll see a sample of doing the opposite: getting access to the SQLConnection to add your own operations to the transaction (under Server Examples -> Transactions -> Transactional User Operations). Would this solve your problem as well?

    Leave a comment:


  • mpretorian
    started a topic SQL Datasource and Spring transaction manager

    SQL Datasource and Spring transaction manager

    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.

    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>
    I'm using Spring 3 and SmartGWT 2.5.2011-05-14-EVAL.
Working...
X