Hi Is there any way I can achieve this. I.e. what I am trying
JCR Specification 7.1.3.5 Resolving Conflicts with Persistent State When an InvalidItemStateException is thrown (either at write-time or save-time) an application may wish to resolve the conflict. The standard solution is to do the following: * If the Item in question has unsaved changes pending, make a temporary copy of it. * refresh(false) the original Item, thus discarding the recent changes (including the one which caused the conflict). * Merge the changes recorded in the temporary copy with the now up-to-date Item object. -----Ursprüngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Tobias Bocanegra Gesendet: Freitag, 28. Juli 2006 13:36 An: [email protected] Betreff: Re: Merge the nodes merge is only used for updating/merging corresponding node in different workspaces that have different base versions. you can't use it to update transient nodes. regards, toby On 7/28/06, Ramesh Devaraj <[EMAIL PROTECTED]> wrote: > Hi > > > > I am not able to merge the nodes. > > > > Unable to perform operation. Session has pending changes. > > at > org.apache.jackrabbit.core.NodeImpl.checkSessionHasPending(NodeImpl.java:3134) > > > > private static void testMultiSession() throws Exception > > { > > SimpleCredentials creds = new > SimpleCredentials("username", > > "password".toCharArray()); > > Session session = repository.login(creds); > > > > SimpleCredentials creds1 = new > SimpleCredentials("username", > > "password".toCharArray()); > > Session session1 = repository.login(creds1); > > String xpath = "customerList/customer/userList/user"; > > Node nodeToModify = getNodeToModify(xpath, session); > > > > Node nodeToModify1 = getNodeToModify(xpath, session1); > > > > nodeToModify.setProperty("data", "modify by session"); > > > > nodeToModify1.setProperty("data", "modify by > session1"); > > > > nodeToModify.save(); > > //export(session); > > try > > { > > nodeToModify1.save(); > > > > } catch (javax.jcr.InvalidItemStateException ex) > > { > > > > //NOW I TRY MERGE THE NODES nodeToModify > and nodeToModify1 > > > > nodeToModify1.merge("default", true); > > //nodeToModify1.save(); > > > > } > > session.logout(); > > session1.logout(); > > > > } > > > > > > > > http://www.maas.de <http://www.maas.de> - Wir integrieren Zukunft > > > > Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte > Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail > irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und > vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte > Weitergabe dieser Mail ist nicht gestattet. > > > > This e-mail may contain confidential and/or privileged information. If you > are not the intended recipient (or have received this e-mail in > error) please notify the sender immediately and destroy this e-mail. Any > unauthorized copying, disclosure or distribution of the material in this > e-mail is strictly forbidden. > > > > > > > > > -- -----------------------------------------< [EMAIL PROTECTED] >--- Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel T +41 61 226 98 98, F +41 61 226 98 97 -----------------------------------------------< http://www.day.com >---
