jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slande...@excilys.com
Subject Re: AW: User Managed Transactions in JackRabbit
Date Thu, 27 Nov 2008 13:48:29 GMT
Once again, if you don't perform composite operations (like a jackrabbit
update and a db update, a jms message sending or whatever inside the same
transaction) you don't need XA.

If you're ready to use Spring tx support, SpringModules provides you with
a LocalTransactionManager for Jackrabbit.

BR,

Stephane Landelle

Le Jeu 27 novembre 2008 14:30, alarcher a écrit :
>

> Thanks Alex for your answer,
>
>
> I understand your comment, the need of transaction is not very meaningful
> in my sample code but it was only an example. You can imagine calling
> Workspace
> methods which acts directly on persistent layer (whereas my sample shows
> only calls acting on the transient layer). In this case, we would need a
> transaction because the Session.save() would have no effect on Workspace
> methods (for example Workspace.copy).
>
> What bothers me is using XA, I would like to use a "simpler" user
> transaction management (or local transaction management).
>
> Thanks again.
>
>
> Regards,
> Antoine Larcher
>
>
>
> Alexander Klimetschek wrote:
>
>>
>> If the only thing you do inside your transaction is JCR, why do you
>> need a global transaction then? Without those XA transactions, a single
>> session.save() works well as a single transaction.
>>
>> Regards,
>> Alex
>>
>>
>> On Thu, Nov 27, 2008 at 10:51 AM, alarcher <antoinelarcher@gmail.com>
>> wrote:
>>
>>>
>>> Thanks guys for your answers,
>>>
>>>
>>> The thing is I do not use an application server, I use jack rabbit in
>>> a very simple batch. The following code [1] works fine, however I
>>> wondered if there was an alternative for using XA Transactions. Which
>>> can do the more can do the less (french expression.. maybe lack of
>>> translation), but XA seems to be - in this example - a bazooka in
>>> order to shoot a fly (another french expression :)  ).
>>>
>>>
>>> I'll have a look at Spring JCR support.
>>>
>>>
>>>
>>> Thanks again.
>>>
>>>
>>> Regards,
>>> Antoine Larcher
>>>
>>>
>>> [1] :
>>> Repository repository = RepositoryImpl.create(config);
>>> XASession session = (XASession)repository.login(new
>>> SimpleCredentials("username", "password".toCharArray()));
>>>
>>>
>>> try {
>>> XAResource xares = session.getXAResource();
>>>
>>>
>>> // dummy Xid
>>> Xid xid = XIDHelper.getDummyXid();
>>>
>>>
>>> // start transaction
>>> xares.start(xid, XAResource.TMNOFLAGS);
>>>
>>> Node root = session.getRootNode();
>>> Node myNode = root.addNode("test");
>>> myNode.addMixin("mix:referenceable");
>>> myNode.setProperty("noderef", myNode); myNode.setProperty("myint",
>>> 4212);
>>>
>>>
>>> session.save();
>>>
>>> Dumper dumper = new DumperImpl();
>>> dumper.dumpAll(root);
>>>
>>> // end transaction
>>> xares.end(xid, XAResource.TMSUCCESS);
>>>
>>> xares.prepare(xid);
>>>
>>> xares.commit(xid, false);
>>>
>>> dumper = new DumperImpl(); dumper.dumpAll(root);
>>>
>>>
>>>
>>>
>>> KÖLL Claus wrote:
>>>
>>>>
>>>> Absolutly ...
>>>>
>>>>
>>>> but i think the most time the current environment will decide which
>>>> container you are use :-)
>>>>
>>>> greets claus
>>>>
>>>>> Actually, you don't need an ApplicationServer to go XA. You can
>>>>> use a lightweight JCA container such as Jencks or Atomikos (I use
>>>>> Jencks).
>>>>>
>>>>
>>>>> Stephane Landelle
>>>>>
>>>>
>>>>
>>>> Le Mer 26 novembre 2008 16:17, KÖLL Claus a écrit :
>>>>
>>>>> hi Antoine,
>>>>>
>>>>> i don't know where you want to run jackrabbit (ApplicationServer)
>>>>>
>>>>>
>>>>> if you want to use xa transaction's managed by the container you
>>>>> must define Jackrabbit as a JCA ResourceAdapter. after that you
>>>>> must define a J2C ResourceFactory and grab this resource through
>>>>> JNDI.
>>>>>
>>>>>
>>>>>
>>>>> if you are now inside a SessionBean with a Transaction associated
>>>>>  jackrabbit will use it ...
>>>>>
>>>>> there is some rarely documentaion out there but here is a
>>>>> "sample"
>>>>> http://wiki.apache.org/jackrabbit/JackrabbitOnJBoss
>>>>>
>>>>>
>>>>>
>>>>> or as Stéphane See springmodules JCR support
>>>>>
>>>>>
>>>>> greets claus
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/User-Managed-Transactions-in-JackRabbit-tp206781
>>> 04p20716244.html
>>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/User-Managed-Transactions-in-JackRabbit-tp20678104p
> 20719306.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>
>
>



Mime
View raw message