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 XASessionImpl
.
I am currently getting a session like this:
final Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
try {
final Session session = repository.login(credentials);
return session;
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
I invoke session.save();
and then session.logout()
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 @Transactional
(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?