jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KÖLL Claus <C.KO...@TIROL.GV.AT>
Subject AW: Transaction over multiple workspaces?
Date Tue, 04 Sep 2007 09:29:58 GMT
hi jan,

i have the same problem 

i have not the same use case as you but i wanted to open a adminsession in the accessmanager
and this causes the same problem as you described. 

my solution was not to open a admin session .. :-)
hope sombody would look at this soon ...


-----Ursprüngliche Nachricht-----
Von: Jan Grathwohl [mailto:jan.grathwohl@kontrast.de] 
Gesendet: Dienstag, 04. September 2007 11:20
An: Jackrabbit Users List
Betreff: Transaction over multiple workspaces?


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.


View raw message