Frandro,

To ensure there is only one node you should rely on a unique constraint. 

The api doesn't have a findOnlyOneNodeByLabelAndProperty, so what you are doing 
is completely necessary. 

 - Lasse



> On 27/08/2014, at 01.36, Frandro <[email protected]> wrote:
> 
> Let's assume that there's only a node. (params: node type, property, 
> property's value)
> 
> It seems that there's a method named findNodesByLabelAndProperty() in 
> GraphDatabaseService.
> 
> But the method returns Iterable, which implies we can get a collection by the 
> method.
> 
> I defined my own method for it.
> ResourceIterator<Node> nodes = mGraphDb.findNodesByLabelAndProperty(label, 
> property, object).iterator();
>         
> while (nodes.hasNext())
>     return nodes.next();         
> 
> return null;
> 
> I'd like to know if there's a better way for finding a unique node.
> 
> Thank you.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to