No, I dont want to update JCR and data source simultaneously, I want to save all the JCR transactions once in the end, by utx.commit() if there are no failure rates, and utx.rollback() in case of single failure. So I think if anyway we can make use of JTA transactions, to store transient data and submit and rollback as needed
repository = JcrUtils.getRepository("http://localhost:4502/crx/server");
//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
Object sling;
//final SlingRepository repository = sling.getService(SlingRepository.class);
// Session session = repository.loginAdministrative(null);
Node root = session.getRootNode();
Hashtable env = new Hashtable();
Context ctx = null;
env.put(Context.PROVIDER_URL, "http://localhost:4502/crx/server");
env.put(Context.INITIAL_CONTEXT_FACTORY,"jcr/repository");
ctx = new InitialContext(env);
UserTransaction utx = (UserTransaction)
ctx.lookup("javax.transaction.UserTransaction");