Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.1 M3 (Lovelace)
    • Component/s: Core
    • Labels:

      Description

      Provide a MongoDB specific PlatformTransactionManager implementation.

      The MongoTransactionManager should create and bind a ClientSession to the thread. Transactions are started, commited or aborted while MongoTemplate automatically detects existing ClientSessions and operates on them accordingly.

      Without the presence of a MongoTransactionManager within the ApplicationContext the template should not participate in any what so ever ongoing transactions. Users have to actively opt in to transaction support. A flag on MongoTemplate should allow to enable transaction support for non native MongoDB transactions.

      @Configuration
      public class Config extends AbstractMongoConfiguration {
      
        @Bean
        MongoTransactionManager transactionManager(MongoDbFactory dbFactory) {
          return new MongoTransactionManager(dbFactory);
        }
      
        // ...
      }
      
      @Service
      public class NightAngel {
      
        @Autowired PersonRepository repository;
      
        @Transactional
        public void trainAzoth() {
      
          Person durzo = repository.findByName("Durzo Blint");
      
          Person kylar = new Person("Kylar Stern");
          kylar.setMaster(durzo);
      
          repository.save(kylar);    
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cstrobl Christoph Strobl
                Reporter:
                cstrobl Christoph Strobl
                Last updater:
                Christoph Strobl
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: