Michal Hybler wrote:

I have method for searching nodes by id.

In this method i gel all nodes by SQL search

query = manager.createQuery("select * from nt:unstructured ",Query.SQL);
                        QueryResult result = query.execute();
and after that iterate by while cycle for node

while(it.hasNext()){                            
                                Node node = it.nextNode();              
                                if (node.getName().length() != 0){
                                                if (getId(node).equals(id)) {
                                                        return new 
Polozka(node.getUUID(),node.getName());
                        }
--- getId is my method represents node.getUUID() and Polozka id my class
represents node.---

but this method is so slow some has better solution fo searching nodes by
Id? Thanks for help Michal Hybler

What does getId(node) do? I suppose it calls getProperty() on the given node. Is that right? In that case you should extend your query to include the id restriction. If your property name for example is "foo:bar" this would like this:

"select * from nt:unstructured where foo:bar='" + id + "'"

This will only return nodes which property foo:bar is set to id.

Cheers,
Christoph

Reply via email to