Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 9763 invoked from network); 18 Nov 2005 16:53:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 16:53:53 -0000 Received: (qmail 62096 invoked by uid 500); 18 Nov 2005 16:53:52 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 62084 invoked by uid 99); 18 Nov 2005 16:53:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2005 08:53:52 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [132.203.250.27] (HELO hermes.ulaval.ca) (132.203.250.27) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2005 08:55:25 -0800 Received: from hermes.ulaval.ca(132.203.250.27) by clouso.ulaval.ca via smtp id 7515_d9adbf4a_5853_11da_90b3_00304811f440; Fri, 18 Nov 2005 11:53:32 -0500 Received: from NIBEL69.bibl.ulaval.ca (poste015-130.bibl.ulaval.ca [132.203.130.15]) by hermes.ulaval.ca (8.13.1/8.12.9) with ESMTP id jAIGrTJE028770 for ; Fri, 18 Nov 2005 11:53:29 -0500 Received: from poste015-130.bibl.ulaval.ca(132.203.130.15) by clouso.ulaval.ca via smtp id 7512_d911db5c_5853_11da_97ff_00304811f440; Fri, 18 Nov 2005 11:53:31 -0500 Message-Id: <6.1.1.1.2.20051118113459.03a2aeb0@hermes.ulaval.ca> X-Sender: biblnbe@hermes.ulaval.ca (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Date: Fri, 18 Nov 2005 11:53:26 -0500 To: jackrabbit-dev@incubator.apache.org From: Nicolas Belisle Subject: Removing a version Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, I'm trying to remove a version of a Node, but the VersionHistory.removeVersion() method throws : "javax.jcr.ReferentialIntegrityException: Unable to remove version. At least once referenced.". Secton 8.2.2.10 (Removal of Versions) of the specification indicates that the version graph should be automatically repaired upon removal. Then, VersionHistory.removeVersion() should take care of references. In fact, a user cannot alter the references (jcr:predecessors and jcr:successors), since they are protected properties. Here's the example : Node root1 = session.getRootNode() ; Node test1 = root1.addNode("test") ; test1.addMixin("mix:versionable"); test1.setProperty("test", "1"); session.save(); test1.checkin(); test1.checkout(); test1.setProperty("test", "2"); session.save(); test1.checkin(); test1.checkout(); test1.setProperty("test", "3"); session.save(); test1.checkin(); VersionHistory vh = test1.getVersionHistory(); for (VersionIterator vi = vh.getAllVersions(); vi.hasNext(); ) { Version currenVersion = vi.nextVersion(); String versionName = currenVersion.getName(); if (!versionName.equals("jcr:rootVersion")) { String propertyValue = currenVersion.getNode("jcr:frozenNode").getProperty("test").getString(); System.out.println("Removing version : " + versionName + " with value: " + propertyValue); vh.removeVersion(versionName); } } Something I do wrong ? Many thanks, Nicolas