jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Grathwohl <jan.grathw...@kontrast.de>
Subject Transaction over multiple workspaces?
Date Tue, 04 Sep 2007 09:19:59 GMT

is it possible in Jackrabbit to have a transaction that spans  
multiple workspaces? What I would like to do is to start a  
UserTransaction, write changes to several Jackrabbit workspaces (all  
from the same repository) and a Hibernate session, and then commit  
all these changes together. My application modifies several  
workspaces concurrently, and I would like to ensure that all these  
changes are either commited or rolled back completely.

I have set up a JCA deployment of Jackrabbit 1.3.1 in JBoss , and it  
works fine as long as I only use one session per transaction. It  
looks from my tests like it is not possible to open more than one  
session within a transaction, and I also found a thread on the  
mailing list that says something like that.

But if I want to work in multiple workspaces, I have to open multiple  
sessions, because session are always per-workspace, right?

So my code to edit multiple workspaces within one transaction would be

		InitialContext ctx = new InitialContext();

		UserTransaction utx = (UserTransaction)ctx.lookup("java:comp/ 

		Repository repo = (Repository)ctx.lookup("java:jcr/local");
		Session session1 = repo.login(new SimpleCredentials("admin",  
"admin".toCharArray()), "workspace1");	
		Session session2 = repo.login(new SimpleCredentials("admin",  
"admin".toCharArray()), "workspace2");
		// Use session1 to write changes to workspace1
		// Use session2 to write changes to workspace2

which doesn't work.

Is there any way to include multiple workspaces within the scope of  
one transaction?

Thank you.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message