I copied the below code(versioningBasics method) from 
http://wiki.apache.org/jackrabbit/ExamplesPage examplesPage  and I am
calling it with:

<snip>
Repository repository = new TransientRepository();
                Session session = repository.login(new 
SimpleCredentials("username",
                                "password".toCharArray()));
                try {
                        Node root = session.getRootNode();

                        versioningBasics(root, session);
</snip>

private static void versioningBasics (Node parentNode, Session session)
throws RepositoryException
    {
          //create versionable node
          Node n = parentNode.addNode("childNode", "nt:unstructured");
          n.addMixin("mix:versionable");
          n.setProperty("anyProperty", "Blah");
          session.save();
          Version firstVersion = n.checkin();

          //add new version
          Node child = parentNode.getNode("childNode");
          child.checkout();
          child.setProperty("anyProperty", "Blah2");
          session.save();
          child.checkin();

          //print version history
          VersionHistory history = child.getVersionHistory();
          for (VersionIterator it = history.getAllVersions(); it.hasNext();)
{
            Version version = (Version) it.next();
            System.out.println(version.getCreated().getTime());
          }
          
          //restoring old version
          child.checkout();
          child.restore(firstVersion, true);          
    }

This is the exception I get, what am I doing wrong?

Exception in thread "main" javax.jcr.RepositoryException: /childNode: unable
to update item.: 8c2ba7f9-7509-433c-99e3-6f28de86b77d:
8c2ba7f9-7509-433c-99e3-6f28de86b77d
        at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1252)
        at org.apache.jackrabbit.core.NodeImpl.checkin(NodeImpl.java:2966)
        at SecondHop.versioningBasics(SecondHop.java:249)
        at SecondHop.main(SecondHop.java:59)


-- 
View this message in context: 
http://www.nabble.com/Unable-to-update-item-exception-while-trying-to-checkin%28%29-tp15190742p15190742.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to