jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Boston <...@tfd.co.uk>
Subject Re: Using JTA and Jackrabbit
Date Thu, 17 Dec 2009 15:22:20 GMT
The standard Jackrabbit Session is an XASession which implements an XAResource which you can
attach to Global transaction.

eg
    XASession xasession = (XASession) session;
    Transaction transaction = transactionManager.getTransaction();
      if (transaction != null) {
        transaction.enlistResource(xasession.getXAResource());
      }

from that point on the XASession will respond to the transaction lifecycle of the transaction.
IIRC, nothing is visible to other threads, the shared item manager or the persistence manager
until transaction.commit() happens, even if sesison.save() happend before then.

HTH
Ian

On 17 Dec 2009, at 14:45, JR wrote:

> The project I'm working on is using Jackrabbit 1.4 for content storage. The
> project is mostly implemented, but we ran into a database issue that caused
> a few saves to the repository to fail in the middle of committing the
> changes. This left the repository in an inconsistent state and was bad all
> around. We'd like to avoid this in the future and I believe the way to do
> that is through transactions. The FAQ [1] mentions that Jackrabbit supports
> the use of JTA and that there are examples of how to do this on the mailing
> list announcement, but I haven't been able to find that announcement or a
> simple example anywhere. Any help would be appreciated. Thanks in advance!
> 
> Jared
> 
> [1]
> http://jackrabbit.apache.org/frequently-asked-questions.html#FrequentlyAskedQuestions-HowdoIusetransactionswithJCR
> ?


Mime
View raw message