java - How do I use Jackrabbit when it is part of a global transaction? -


i using jackrabbit datastore , separate database rest of data. have deployed jackrabbit jca jboss 7.1.1. have debugged application , see session instance of type xasessionimpl.

i getting session 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(); , session.logout() when done each time access it. correct when part of global transaction. not have knowledge distributed transactions etc please correct me if wrong. tried throw runtime exception inside 1 of methods annotated @transactional (using spring 3.2), data in datastore not removed. correct? doesn't data being added in data store removed if transaction rolled back? "testing" enviroment was: add content jackrabbit, database , throw runtime exception. or isn't jackrabbit configured correctly?

jackrabbit running own transaction, assuming spring-managed transaction rolled content in datastore remains. how spring/jboss resource configuration like?

some quick googling (with keywords jta jackrabbit spring jboss) reveals setting xa transactions jackrabbit , xa jdbc datasource might easier said done. old mailing list entries report being able use jta transaction manager called jencks this, jencks' development appears since have been discontinued.

also have (though grain of salt) @ section 1.2.3 in this jboss community wiki page states "jackrabbit implements xa protocol internally , requires non-xa datasource underneath", implies behavior you're seeing.

also, option xa, have considered emulating xa (mind pseudo-code)?:

@transactional public void addcontent() {     try {         storecontentinjcrrepo();         savemetadataindatabase();     catch (dataaccessexception e) {         deletenewlystoredcontentfromjcrrepo();         // rethrow ensure db transaction rolled         throw e;     } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -