Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 28260 invoked from network); 18 Nov 2005 17:24:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 18 Nov 2005 17:24:37 -0000 Received: (qmail 12785 invoked by uid 500); 18 Nov 2005 17:24:16 -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 12706 invoked by uid 99); 18 Nov 2005 17:24:14 -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 09:24:14 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of edgarpoce@gmail.com designates 64.233.184.200 as permitted sender) Received: from [64.233.184.200] (HELO wproxy.gmail.com) (64.233.184.200) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2005 09:25:47 -0800 Received: by wproxy.gmail.com with SMTP id 55so408595wri for ; Fri, 18 Nov 2005 09:23:52 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=AJz8E0xHZRFbarOvXfJtWF5vMj3R+eUq8ZFDAzwrq061K3IeDd/FnPEpaorLWzEzc3uW3j9YMJfd25Fmrli+mT3EKOtn7M0Rg1zGwztycy912/L9aWEKHdVoIcYIIOZH+YOzTBDR23ePJviYUxOUj3nCd6gnpL9Yx/xug6F7C5g= Received: by 10.65.22.6 with SMTP id z6mr4322005qbi; Fri, 18 Nov 2005 09:23:52 -0800 (PST) Received: by 10.65.253.6 with HTTP; Fri, 18 Nov 2005 09:23:52 -0800 (PST) Message-ID: <8a83c96b0511180923o6e37e523p5e2ac8171ecd4269@mail.gmail.com> Date: Fri, 18 Nov 2005 14:23:52 -0300 From: Edgar Poce To: jackrabbit-dev@incubator.apache.org Subject: Re: Removing a version In-Reply-To: <6.1.1.1.2.20051118113459.03a2aeb0@hermes.ulaval.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6.1.1.1.2.20051118113459.03a2aeb0@hermes.ulaval.ca> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Nicolas, I didn't try your code but I think it throws ReferentialIntegrityException because you are trying to remove the base version which is referenced by the versioned node. see http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/3746 br, edgar On 11/18/05, Nicolas Belisle wrote: > 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 =3D session.getRootNode() ; > Node test1 =3D 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 =3D test1.getVersionHistory(); > for (VersionIterator vi =3D vh.getAllVersions(); vi.hasNext(); )= { > Version currenVersion =3D vi.nextVersion(); > String versionName =3D currenVersion.getName(); > if (!versionName.equals("jcr:rootVersion")) { > String propertyValue =3D > 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 > >