Re: [Neo4j] Custom Node ID

589 views
Skip to first unread message

Peter Neubauer

unread,
Oct 19, 2012, 7:27:14 AM10/19/12
to ne...@googlegroups.com
Hi there,
are you talking about Spring Data Neo4j regarding the versions?

Cheers,

/peter neubauer

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

Neo4j 1.8 GA - http://www.dzone.com/links/neo4j_18_release_fluent_graph_literacy.html


On Fri, Oct 19, 2012 at 12:43 PM, juriz <jur...@googlemail.com> wrote:
> Hi,
>
> i need to make some relationships between a relational DB and Neo4j. So i
> was setting the ID of my Neo4j Domain Object equal to the ID
> of my relational entities.
> This solution worked fine with Neo4j 2.0.2 but I upgraded to version 2.1.0
> and now I am getting a NotFoundException when i am trying to save a new
> object. So I think this happens because the object already has an ID and neo
> tries to update the old one.
>
> So how would you solve that? I could create another property on my neo
> objects like "relationalID" and index it and how could I this object? still
> with findOne? I really need fast performance on that queries.
>
> Thanks.
>
> --
>
>

juriz

unread,
Oct 19, 2012, 7:34:31 AM10/19/12
to ne...@googlegroups.com
Hi,

yes I am using Spring Data.

Michael Hunger

unread,
Oct 20, 2012, 9:33:01 PM10/20/12
to ne...@googlegroups.com
This shouldn't have worked in 2.0.2 either.

The neo4j id is generated by the database and cannot be set manually.
Please add a separate field for your id of the relational database and index it when necessary (for looking them up).

HTH

Michael

Michael Hunger

unread,
Oct 24, 2012, 5:26:26 AM10/24/12
to ne...@googlegroups.com
You would use the custom id's to find the starting points for your traversal, then you rely in matching the patterns you describe (by following relationships) that connect those nodes you looked up in the index.

That's the difference to other databases which use index-based lookups for the actual joins (which the graphdb doesn't do).

Michael

Am 24.10.2012 um 11:19 schrieb Dmitra Kyianytsia:

> hi
> I can't use custom ID as separate field because Relationship references nodes by real ID
> So, getting relationship with custom ID I need to retrieve all nodes, but this impacts performance insanely when having many relationships
>
> I really need custom ID in the case like git works
> Network of clients operate with nodes by hash like (32 characters string)
> Each of them has local storage
> And when they sync with server, nodes are stored in DB (Neo4j)
> Thus, centralized structure with db assigned ids are not acceptable
>
> Could you, please, enlight any possibility to cope with this situation
>
> --
>
>

Reply all
Reply to author
Forward
0 new messages