jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alarcher <antoinelarc...@gmail.com>
Subject Re: AW: User Managed Transactions in JackRabbit
Date Thu, 27 Nov 2008 09:51:17 GMT

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-tp20678104p20716244.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message