Java: get node ID after node creation

1,106 views
Skip to first unread message

Tomas Teicher

unread,
Apr 16, 2012, 8:53:18 AM4/16/12
to ne...@googlegroups.com
I am creating new node using createNode() method (called as method of Java EmbeddedGraphDatabase object)

Is it possible to get ID of created node? 

I know I can create my custom property "id" and set it to node. But if possible, I would like to use already existing neo4j node ID. I don't need to set it by myself, just get its value once it is created.
Is it possible using Java?

thanks
Tomas

Peter Neubauer

unread,
Apr 16, 2012, 8:55:11 AM4/16/12
to ne...@googlegroups.com
try

node.getId()

HTH.

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

Neo4j                                - Graphs rule.
Program or be programmed - Computer Literacy for kids.
http://foocafe.org/#CoderDojo

Michael Hunger

unread,
Apr 16, 2012, 9:09:06 AM4/16/12
to ne...@googlegroups.com
For your custom id use a node property and index it, best to go with the unique factory to ensure that you only have one instance of that id in the graph.

Tomas Teicher

unread,
Apr 16, 2012, 10:00:51 AM4/16/12
to ne...@googlegroups.com
thank you

tomas

2012/4/16 Michael Hunger <michael...@neotechnology.com>
Reply all
Reply to author
Forward
0 new messages