You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#12311 introduced support for executing SQL scripts declaratively in the TestContext framework via @Sql. This support provides an algorithm for looking up a requiredPlatformTransactionManager to use to drive transactions. However, a transaction manager is not actually required for all testing scenarios. We therefore need to revise the transaction management support for @Sql so that SQL scripts will be executed without a transaction if a transaction manger is not present in the ApplicationContext.
Deliverables
Revise transaction management in SqlScriptsTestExecutionListener using the following algorithm.
if a transaction manager and data source are both specified via @SqlConfig, retain the current behavior.
if a transaction manager is not specified, execute the SQL scripts directly without a transaction, requiring the presence of a data source.
if a data source is not explicitly specified, infer it via the getResourceFactory() method provided by the ResourceTransactionManager interface, which the transaction manager may potentially implement.
otherwise, throw an IllegalStateException.
if @SqlConfig.transactionMode is set to ISOLATED, throw an exception if a transaction manager is not specified or not present in the ApplicationContext.
Sam Brannen opened SPR-11911 and commented
Status Quo
#12311 introduced support for executing SQL scripts declaratively in the TestContext framework via
@Sql. This support provides an algorithm for looking up a requiredPlatformTransactionManagerto use to drive transactions. However, a transaction manager is not actually required for all testing scenarios. We therefore need to revise the transaction management support for@Sqlso that SQL scripts will be executed without a transaction if a transaction manger is not present in theApplicationContext.Deliverables
Revise transaction management in
SqlScriptsTestExecutionListenerusing the following algorithm.@SqlConfig, retain the current behavior.getResourceFactory()method provided by theResourceTransactionManagerinterface, which the transaction manager may potentially implement.@SqlConfig.transactionModeis set toISOLATED, throw an exception if a transaction manager is not specified or not present in theApplicationContext.Affects: 4.1 RC1
Issue Links:
@Sqlscript support in the reference manual ("is depended on by")@SqlConfigfor common SQL script configurationReferenced from: commits 2e75adb