Definetly!
It works!

Thanks a lot!

Magnolians, this is a bug?
I mean:

create a parent
save the parent
create a children
save the children
--> error

BUT:

create a parent
save the parent
create a children
save the parent
--> success




SeanMcTex ha scritto:
We've found that when you create a new node, you often have to save the
parent, rather than the new node itself, to get it to persist to JCR. Here's
a bit of sample code from one of our utility scripts:

                        Content collection = page.createContent( 
"contentParagraph",
ItemType.CONTENTNODE.getSystemName() );
                        page.save();

                        Content paragraph = collection.createContent( "0",
ItemType.CONTENTNODE.getSystemName() );
                        paragraph.setNodeData("content", 
valueFactory.createValue( text ));
                        MetaData meta = paragraph.getMetaData();
                        meta.setTemplate( "texasEditor" );
                        collection.save();





Magnolia - User mailing list-2 wrote:
Hi All, can you help me with this behaviour? No idea why it fails to create a new content node...


// create path for this node under "data". It works, path is created and
// visible in JCR Browser
// basePathis "/folder1/folder2"
final Content baseNode = createPath(basePath, hm);

// save this (persistently apply changes to repo)
baseNode.save();

// I have a data type called "myType".
// So I want to create a new Content Type under "basePath".
Content newNode = baseNode.createContent("test", "myType");

// set name
newNode.createNodeData("name").setValue("test");

// save children
newNode.save();

at this point I have an exception:

"/folder1/folder2/test: cannot save a new item."



Any Idea?

Thanks..
M.


----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------





----------------------------------------------------------------
for list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
----------------------------------------------------------------

Reply via email to