Hi,
I'm traversing a Node set, calling getProperty on each node. However, the value
returned is always '1', even if this isn't the value of the property. I've
confirmed in neoclipse that one specific node has a 'count' property of 2, but
when I debug my code, the value '1' is returned for that node.
Below is my code. Am I using transactions correctly, or do I need to start a
new
Transaction for each read operation (i.e. inside the 'for' loop)?
Thanks,
Tim
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
try
{
userPathService.beginTransaction();
Page startPage = lookupSearchService.searchPage(url);
Node startNode = startPage.getUnderlyingNode();
// traverse over all Route nodes related to the start node
Traverser traverser = startNode.traverse(
Order.BREADTH_FIRST,
StopEvaluator.DEPTH_ONE,
ReturnableEvaluator.ALL_BUT_START_NODE,
Relationships.ROUTE, Direction.INCOMING);
// add all the nodes to an array
Map<Integer, List<String>> routes = new HashMap<Integer,
List<String>>();
List<String> pathList;
Route route;
// debug variables
Integer count;
String myPath;
for (Node routeNode : traverser)
{
route = new Route(routeNode);
if (!routes.containsKey(route.getCount()))
{
routes.put(route.getCount(), new ArrayList<String>());
}
// the following is always set to '1'
count = route.getCount();
// the correct path is always returned
myPath = route.getPath();
pathList = routes.get(route.getCount());
pathList.add(route.getPath());
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// the Route class:
public static final String COUNT = "count";
public Integer getCount()
{
return (Integer)node.getProperty(COUNT);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user