We ran a test case in which we purposely change the userName of the dataSource2, but the writes in dataSource (one) were commited.
The spring log follows:
Code:
...
2006-03-09 11:50:33,462 DEBUG RuleBasedTransactionAttribute:119 - Applying rules to determine whether transaction should rollback on my.company.service.ServiceException: my.company.service.ServiceException: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot get connection for URL jdbc:oracle:thin:@myhost2:1521:mydb2 : ORA-01017: invalid username/password; logon denied
2006-03-09 11:50:33,463 DEBUG RuleBasedTransactionAttribute:137 - Winning rollback rule is: null
2006-03-09 11:50:33,464 DEBUG RuleBasedTransactionAttribute:143 - No relevant rollback rule found: applying superclass default
2006-03-09 11:50:33,465 DEBUG TransactionInterceptor:298 - my.company.service.MyServiceImpl.runDistributedTransaction threw throwable [my.company.service.ServiceException: my.company.service.ServiceException: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot get connection for URL jdbc:oracle:thin:@myhost2:1521:mydb2 : ORA-01017: invalid username/password; logon denied
] but this does not force transaction rollback
2006-03-09 11:50:33,466 DEBUG JtaTransactionManager:653 - Triggering beforeCommit synchronization
2006-03-09 11:50:33,470 DEBUG SessionFactoryUtils:882 - Flushing Hibernate Session on transaction synchronization
2006-03-09 11:50:33,893 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19abd2b] for key [StandardXADataSource:
connection count=<0>
number of dead connection=<0>
dead lock max wait=<300000>
dead lock retry wait=<10000>
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
driver name=<oracle.jdbc.driver.OracleDriver>
number of *free* connections=<0>
max con=<0>
min con=<50>
prepared stmt cache size=<16>
transaction manager=<org.objectweb.jotm.Current@19836ed>
xid connection size=<0>
StandardConnectionPoolDataSource:
master prepared stmt cache size=<0>
prepared stmt cache size =<16>
StandardDataSource:
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
url=<jdbc:oracle:thin:@myhost:1521:mydb>
user=<db.user>
CoreDataSource :
debug =<false>
description =<null>
login time out =<60>
user =<db.user>
verbose =<false>
] bound to thread [main]
2006-03-09 11:50:34,203 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19abd2b] for key [StandardXADataSource:
connection count=<0>
number of dead connection=<0>
dead lock max wait=<300000>
dead lock retry wait=<10000>
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
driver name=<oracle.jdbc.driver.OracleDriver>
number of *free* connections=<0>
max con=<0>
min con=<50>
prepared stmt cache size=<16>
transaction manager=<org.objectweb.jotm.Current@19836ed>
xid connection size=<0>
StandardConnectionPoolDataSource:
master prepared stmt cache size=<0>
prepared stmt cache size =<16>
StandardDataSource:
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
url=<jdbc:oracle:thin:@myhost:1521:mydb>
user=<db.user>
CoreDataSource :
debug =<false>
description =<null>
login time out =<60>
user =<db.user>
verbose =<false>
] bound to thread [main]
2006-03-09 11:50:34,430 DEBUG JtaTransactionManager:669 - Triggering beforeCompletion synchronization
2006-03-09 11:50:34,431 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.orm.hibernate3.SessionHolder@18e18a3] for key [org.hibernate.impl.SessionFactoryImpl@1f38fc6] from thread [main]
2006-03-09 11:50:34,437 DEBUG SessionFactoryUtils:785 - Closing Hibernate Session
2006-03-09 11:50:34,445 DEBUG TransactionSynchronizationManager:137 - Retrieved value [org.springframework.jdbc.datasource.ConnectionHolder@19abd2b] for key [StandardXADataSource:
connection count=<0>
number of dead connection=<0>
dead lock max wait=<300000>
dead lock retry wait=<10000>
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
driver name=<oracle.jdbc.driver.OracleDriver>
number of *free* connections=<0>
max con=<0>
min con=<50>
prepared stmt cache size=<16>
transaction manager=<org.objectweb.jotm.Current@19836ed>
xid connection size=<0>
StandardConnectionPoolDataSource:
master prepared stmt cache size=<0>
prepared stmt cache size =<16>
StandardDataSource:
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
url=<jdbc:oracle:thin:@myhost:1521:mydb>
user=<db.user>
CoreDataSource :
debug =<false>
description =<null>
login time out =<60>
user =<db.user>
verbose =<false>
] bound to thread [main]
2006-03-09 11:50:34,447 DEBUG TransactionSynchronizationManager:185 - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@19abd2b] for key [StandardXADataSource:
connection count=<0>
number of dead connection=<0>
dead lock max wait=<300000>
dead lock retry wait=<10000>
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
driver name=<oracle.jdbc.driver.OracleDriver>
number of *free* connections=<0>
max con=<0>
min con=<50>
prepared stmt cache size=<16>
transaction manager=<org.objectweb.jotm.Current@19836ed>
xid connection size=<0>
StandardConnectionPoolDataSource:
master prepared stmt cache size=<0>
prepared stmt cache size =<16>
StandardDataSource:
driver=<oracle.jdbc.driver.OracleDriver@1522de2>
url=<jdbc:oracle:thin:@myhost:1521:mydb>
user=<db.user>
CoreDataSource :
debug =<false>
description =<null>
login time out =<60>
user =<db.user>
verbose =<false>
] from thread [main]
2006-03-09 11:50:34,448 DEBUG DataSourceUtils:276 - Returning JDBC Connection to DataSource
2006-03-09 11:50:34,579 DEBUG JtaTransactionManager:493 - Initiating transaction commit
2006-03-09 11:50:34,706 DEBUG JtaTransactionManager:693 - Triggering afterCompletion synchronization
2006-03-09 11:50:34,707 DEBUG TransactionSynchronizationManager:265 - Clearing transaction synchronization