title: How do I use Jackrabbit when it is part of a global transaction?
body: <p>I am using Jackrabbit with datastore and a separate database for the rest of my data. I have deployed Jackrabbit JCA to JBoss 7.1.1. I have debugged the application and I see that the session instance is of type <code>XASessionImpl</code>. </p>
  
  <p>I am currently getting a session like this:</p>
  
  <pre><code>    final Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
  
      try {
          final Session session = repository.login(credentials);
          return session;
      } catch (RepositoryException e) {
          throw new RuntimeException(e);
      }
  </code></pre>
  
  <p>I invoke <code>session.save();</code> and then <code>session.logout()</code> when I am done each time I access it. Is this correct when it is part of a global transaction. I do not have much knowledge about distributed transactions etc so please correct me if I am wrong. I tried to throw a runtime exception inside one of my methods that is annotated with <code>@Transactional</code> (using Spring 3.2), but the data in the datastore is not removed. Is this correct? Doesn't data that is being added in the data store removed if the transaction is rolled back? My "testing" enviroment for this was: add content to Jackrabbit, then to database and then throw runtime exception. Or isn't Jackrabbit configured correctly?</p>