Hi Jan,
can you tell me, what happens when you commit your user transaction?
Is there an exception or a timeout or...
Kind regards
Dominique
On 04/09/07, Jan Grathwohl <[EMAIL PROTECTED]> wrote:
> Hi,
>
> 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/
> UserTransaction");
> utx.begin();
>
> 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
>
> session1.save();
> session2.save();
>
> utx.commit();
>
> which doesn't work.
>
> Is there any way to include multiple workspaces within the scope of
> one transaction?
>
>
> Thank you.
>
> Jan
>
>