We use Platform transaction management of Spring , the below example is how we use it.

DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition();
transactionStatus  = transactionManager.getTransaction(transactionDefinition);
//do some datasource staff
transactionManager.commit(transactionStatus);

In situations where we do not commit or rollback the transaction ; the transaction status is attached to thread and not removed on returning the thread to pool. next time when the same thread is reused. any new transaction in case on TransactionDefinition.PROPAGATION_REQUIRED gives older transaction status and the current function calling the tx Manager doesn't become owner. So when the work is done and the function tries to commit or rollback , the transaction is not actually commited. Beacause we use the websphere jndi datasource,it finds that we use a connection and start a transaction but forget to commit,so it decide to rollback back the transaction and print a log like WLTC0033W: Resource XXX rolled back in cleanup of Local TransactionContainment One or more local transaction resources were rooled back during the clean up of a LocalTransactionContainment. In my option, when I forget to commit the transaction,it should only influence the current transaction,but not any transaction handled by the same thread.Can spring offer some filter or interceptor to clean up the transaction information at the end of the http request.

Comment From: snicoll

Thanks for the suggestion, but the core framework provides several assistance in making sure that the transaction boundary is applied correctly. You could use @Transactional or TransactionTemplate. If you insist or handling the transaction manually, the onus is on you to make sure it's processed properly.