On 9/1/06, Jukka Zitting <[EMAIL PROTECTED]> wrote:
Hi,On 9/1/06, Nicolas <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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/ - [EMAIL PROTECTED] Software craftsmanship, JCR consulting, and Java development
