I am using JdbcTemplate in a very simple fashion, basically to do mass
updates within a session bean's method. I have no configuration for any
Spring classes defined. The session bean is using CMT.
The method is similar to
Now, however, I need to have another method on the session bean callCode:public void updateTmpQue( Finder criteria ) throws RemoteApplicationException { String dataSourceName = "jdbc/SessionDs"; DataSource = (DataSource) getInitialContext().lookup( dataSourceName ); // Insert this chunk into temporary_que JdbcTemplate template = new JdbcTemplate( dataSource ); template.batchUpdate( m_insertSql, new TmpQuePreparedStatementSetter( criteria ) ); }
the above method, then perform a query against some of the updated
rows. The query is using the same technique with a JdbcTemplate,
except it executes a query instead of an update.
The problem is that the query doesn't see the updated rows. I'm assuming
this is because, even though it is within the same CMT transaction, the
connection that the JdbcTemplate gets from the datasource is different,
and so the query can't see the updates.
Is there a way I can have both JdbcTemplates share the same connection?
Thanks,
: jay


Reply With Quote