jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "oliver.gregory@gmail.com" <oliver.greg...@gmail.com>
Subject ignore ChildNodeInfo
Date Thu, 29 Nov 2012 21:50:51 GMT
Hello,

I would like to update a node and his childs with Jackrabbit 2.4.3 throw
jcr2spi. ( like a merge : updating, creating or removing nodes )

But when I update a property already existing in the repository I have an
ERROR in the log, and nothing is saved. It's not an exception, only an
error.

 [ERROR] org.apache.jackrabbit.jcr2spi.hierarchy.ChildNodeEntriesImpl:176 -
ChildInfo iterator contains multiple entries with the same name|index or
uniqueID -> ignore ChildNodeInfo.

my code :

        Repository repository = JcrUtils.getRepository(jcrUrl);
        Session session = repository.login( new SimpleCredentials("admin",
"admin".toCharArray()));

        try {
            String user = session.getUserID();
            String repositoryname =
repository.getDescriptor(Repository.REP_NAME_DESC);
            LOGGER.debug( "Logged in as " + user + " to a " +
repositoryname + " repository.");


            // Retrieve content
            StringBuilder expression = new StringBuilder();
            expression.append("SELECT * FROM [nt:unstructured] AS mynode ");
            expression.append("WHERE id = "+ mynode.getId() +" " );

            QueryManager queryMgr =
session.getWorkspace().getQueryManager();
            Query query =
queryMgr.createQuery(expression.toString(),Query.JCR_SQL2);
            QueryResult result = query.execute();
            RowIterator rowIterator = result.getRows();

            if (rowIterator.hasNext() ) {
                Node node = rowIterator.nextRow().getNode();

                // Store metadata content
                node.setProperty("description", mynode.getDescription());
                node.setProperty("keywords", mynode.getKeywords());
                node.setProperty("title", mynode.getTitle());   // ERROR IN
THE LOG AT THIS LINE because description and keywords doesn't exist, but
title already exist.
                node.setProperty("resume", mynode.getResume());

                [... updating childs node here ]

                session.save();

            }
        } catch ( RepositoryException e) {
            LOGGER.error("Error getting data", e);
            throw e;
        } finally {
            session.logout();
        }
        return book;
    }



Thanks for your help,

Grégory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message