You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ramesh Devaraj <r....@maas.de> on 2006/07/28 10:40:44 UTC

Merge the nodes

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. 

 

 

 


Re: Merge the nodes

Posted by Tobias Bocanegra <to...@day.com>.
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 <r....@maas.de> 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.
>
>
>
>
>
>
>
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
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 >---