Quantcast
Channel: Adobe Community : Popular Discussions - CQ5 (read only)
Viewing all articles
Browse latest Browse all 12476

How to use transaction in jsp in CQ5.5

$
0
0

Hello,

 

i'm playing around with transactions Jackrabbit should be capable of

 

I didn't find any resource to that specific topic.

 

Here's my code so far, but it isn't working properly...

 

final SlingRepository repository = sling.getService(SlingRepository.class);
Session session = repository.loginAdministrative(null);

UserTransaction utx = sling.getService(UserTransaction.class);
utx.begin();
out.println(utx.getStatus());
Node node = session.getNode("/path/to/a/content");
node.setProperty("a","property");
session.save();
out.println(utx.getStatus());
utx.rollback();
session.logout();

 

Expected result: The Property "a" is not appended to the node because Transaction was rolled back

 

Achieved result so far: The property is saved to the node.

 

What am i doing wrong?

What is the preferred way to use transaction?

 

Background: we are doing some asset operations in user profile node that take some time. It seems that the reverse replication launcher starts in between the process and breaks the replication process every now and then

 

 

Thanks for advice

 

Marc


Viewing all articles
Browse latest Browse all 12476

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>