jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: question about save Node
Date Fri, 01 Sep 2006 13:47:49 GMT
On 9/1/06, Jukka Zitting <jukka.zitting@gmail.com> wrote:
> Hi,
>
> On 9/1/06, Nicolas <ntoper@gmail.com> wrote:
> > Try a session.save() please
>
> It's the equivalent to a save() on the parent node in this case.
> Something that Christophe doesn't want to do.
>
> > On 9/1/06, Ducrocq Christophe <Christophe.Ducrocq@atosorigin.com> wrote:
> > > But, I do parent.save(), I save all children of parent. (What does not
> > > interest me)
> > >
> > > On which node has to call upon the method save() ?
> > > How then I to make to solve my problems?
>
> One solution that was discussed earlier was to have a separate
> "staging" node where you create and save the new node, and then use
> Workspace.move() it to the correct location. Workspace.move() is
> immediately persisted without a need to call save(), so it avoids your
> problem.
>
> On a related note, I think it might make sense to implement a feature
> in Jackrabbit that allows you to do the following:
>
>     Node parent = Session.getRootNode().getNode(...);
>     Node child = parent.addNode(...);
>     child.save();

that would be a violation of the jsr 170 spec:

see 7.1.4 Adding Nodes
[...]
In order to save a newly added node, save must be called either on the
Session, or on the new node's parent or higher-order ancestor
(grandparent, etc.). An attempt to call save only on the newly added
node will throw a RepositoryException.
[...]

cheers
stefan

>
> Feel free to file a Jira feature request for that if you like. Patches
> are also welcome (warning: requires diving deep into Jackrabbit
> internals).
>
> BR,
>
> Jukka Zitting
>
> --
> Yukatan - http://yukatan.fi/ - info@yukatan.fi
> Software craftsmanship, JCR consulting, and Java development
>

Mime
View raw message