cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Does the Node Id Map to @Id?

scott2
Node Link

I am using sdn rx beta04.

When I create an object like this:

@Node
class Something
{
  @Id
   @GeneratedValue
  public Long id;
}

right now Id is not being generated when i save. Additionally i would expect that if using a long & GeneratedValue it would use the node id as in MATCH (n) return id(n);

Have I found a bug or am i incorrect in my assumptions?

1 REPLY 1

You are right with your assumption and I just checked this very simple case:

  • package private class
  • public id
  • nothing else

accessed by a SomethingRepository either also package private or public.
This is working as expected.
Saving:

OPTIONAL MATCH (hlp:`Movie`) WHERE id(hlp) = $__id__ WITH hlp WHERE hlp IS NULL CREATE (n:`Movie`) SET n = $__properties__ RETURN id(n) UNION MATCH (n) WHERE id(n) = $__id__ SET n = $__properties__ RETURN id(n)

Loading:

MATCH (n:`Movie`) WITH n, id(n) AS __internalNeo4jId__ RETURN n{__internalNeo4jId__: id(n), __nodeLabels__: labels(n)}

So I would need, again , more details about how you access the data and/or other helpful informations.