jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Eggerling-Boeck" <paulbo...@yahoo.com>
Subject XA Transaction question
Date Wed, 28 Feb 2007 17:14:38 GMT
I read the Jackrabbit FAQ about transactions and have implemented
something like the following:

InitialContext context = new InitialContext();
Context environment = (Context) context.lookup("java:comp/env");
Repository repository = (Repository) environment.lookup("jcr/repository");
XASession session = (XASession)repository.login(new
SimpleCredentials("username", "password".toCharArray()), null);

XAResource xares = session.getXAResource();

// XID stuff from FAQ is next

xares.start(xid, XAResource.TMNOFLAGS);
// Create some nodes and properties
xares.end(xid, XAResource.TMSUCCESS);

Note that I'm testing a rollback here so there's no xares.prepare() or

My problem is that the changes get persisted and not rolled back.  I'm
not using a UserTransaction or any transaction manager, just going at
the XAResource directly.  I read in the archives that the
session.save() method is all-or-nothing in and of itself so do I
really even need to do XA transactions if I just want to make sure all
my changes to the session are persisted as a unit?

Am I doing something wrong?  Anybody else run into this?

BTW, I'm using
org.apache.jackrabbit.core.fs.local.LocalFileSystem and



View raw message