title: Ignite transactional cache with Spring transaction management
body: <p>I am exploring Ignite transactional cache. I already have a piece of code which uses Spring transaction management for JDBC. I wanted to integrate ignite transactional cache in the code using Spring cache abstraction.</p>
  
  <p>I came across SpringTransactionManager (provided by Ignite) but I am unable to find the proper way to use it. Essentially, I want to do something like:</p>
  
  <pre><code>@Transactional
  @Cacheable(cacheNames="personcache", key="#person.id", unless="#result == null")
  public Person create(Person person) {
      String queryPerson = "insert into Person (id, name) values (?,?)";
      JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
      jdbcTemplate.update(queryPerson, new Object[] { person.getId(), person.getName() });
      System.out.println("Inserted into Person Table Successfully");
      return person;
  }
  </code></pre>
  
  <p>When the transaction commits, database and cache should get committed together. For this, Ignite docs mention the use of SpringTransactionManager <a href="https://www.gridgain.com/sdk/pe/latest/javadoc/org/apache/ignite/transactions/spring/SpringTransactionManager.html" rel="nofollow noreferrer">https://www.gridgain.com/sdk/pe/latest/javadoc/org/apache/ignite/transactions/spring/SpringTransactionManager.html</a>.</p>
  
  <p>I am not sure how to plug this transaction manager along with Spring's DriverManagerDataSource <a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/datasource/DriverManagerDataSource.html" rel="nofollow noreferrer">https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/datasource/DriverManagerDataSource.html</a></p>
  
  <p>Can someone please guide me? An example would help a lot.
  Thanks!</p>