Hey Aman I am not sure that I 100% understand, but you can be sure that Neo 
will generate node ids greater than 0 for each new node you create. With 
your @NodeEntity annotated classes you will map the ID to a field using the 
@GraphId annotation. You can safely do front end validation on node id > 0.

You can not set this ID value, this is the internal ID used by Neo and it 
is important to realise that it is not incremental and that the IDs do get 
recycled (when nodes get deleted the ID of that node will be re-used). It 
is therefore recommended that you add you own identification fields if you 
need to use the ID in any 3rd party systems. Neo does not have a mechanism 
for generating this separate external identifier for you, but there are a 
couple of handy blog post which talk about how to leverage event hooks to 
add the data at node creation time - this 
<http://blog.armbruster-it.de/2013/08/assigning-uuids-to-neo4j-nodes-and-relationships/>
 
being one of them. I am currently trying to utilise the MERGE operator to 
create my nodes as it has handy ON CREATE/ON MATCH semantics which can 
allow autoincrement type behaviour, see this gist 
<http://www.neo4j.org/graphgist?8012859> - this works great but I have had 
issues getting it to work when currency/HA is involved.

With regards to validating if the request from the front end is valid, how 
would you validate that with or without Neo?

Does that address what you were asking, sorry if I've missed the point,

M

On Wednesday, 3 September 2014 20:09:13 UTC+1, Aman Gupta wrote:
>
> each node which is saved in neo4j database, has an nodeId 0
>>
>
> Little correction here. not each node. but the one which get created 
> first. :) 
>  
> On Thursday, 4 September 2014 00:36:11 UTC+5:30, Aman Gupta wrote:
>>
>> Hello Everyone,
>>
>> I am designing an application with several Domain/ entity classes with 
>> Jersey and Spring integration. Thing is, during initial time, or say first 
>> execution, each node which is saved in neo4j database, has an nodeId 0. Its 
>> a point of my interest. How can we make it sure that each nodeId should be 
>> atleast greater than 0 ?
>>
>> Why I need this ?
>>
>> I need this because I think, it would help me while validating request, 
>> received from front end. Consider a scenario of Updating a node which hold 
>> nodeId value as 0. Now what would be the best approach to check if nodeId 
>> is correct or not ? Indeed I can make call to db and be done with it, but I 
>> dont want that. I saw in case of Spring Data JPA, where we have 
>> @GeneratedValue from J2EE, which atleast provide some sort of control to 
>> generate Id of our choice. but I didn't or say I am yet not able to find 
>> any such provision if made.
>>
>> Is there any thing which I am missing confrontational points ? FYI I have 
>> Spring Data Neo4j latest stable release and Neo4j 2.1.3 server.
>>
>> Thanks
>>
>

-- 
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