Michal Hybler wrote:

I have this method
                        ws = session.getWorkspace();
                        manager = ws.getQueryManager();
                        query = manager.createQuery("select * from 
nt:unstructured where jcr:uuid
= '"+id+"'",Query.SQL);
                        QueryResult result = query.execute();
                        NodeIterator it = result.getNodes();
return it.nextNode(); with Id which I remembered when I insert file into jackrabbit.

after that I run this code

HashMap<String,String> properties = new HashMap<String,String>();
                try {
                        PropertyIterator iter = node.getProperties();
                        while(iter.hasNext()){
                                Property prop = iter.nextProperty();
                                if (!prop.getDefinition().isMultiple()) {
                                        properties.put(prop.getName(), 
prop.getValue().getString());
                                }
                                
                        }
                        if (getResNode(node) != null) {
                                Node resNode = getResNode(node);
                                iter = resNode.getProperties();
                                while(iter.hasNext()){
                                        Property prop = iter.nextProperty();
                                        if (!prop.getDefinition().isMultiple()) 
{
                                                properties.put(prop.getName(), 
prop.getValue().getString());
                                        }
                                }
                        }

I don't know what getResNode(node) does, but I suppose it loads some other node which is different to the one retrieved by the query. If you remove this if-block the uuids should be equal as far as I can see. And as Brian already wrote: you should be better off using session.getNodeByUUID() instead of using a query. This method performs much faster than a query.

Cheers,
Christoph

Reply via email to