Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad id returned when querying with Gremlin [DATAGRAPH-211] #774

Closed
spring-projects-issues opened this issue Mar 15, 2012 · 1 comment
Closed
Labels
in: core status: invalid

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Mar 15, 2012

Marc de Verdelhan opened DATAGRAPH-211 and commented

Set up a repository and a Gremlin query:
public interface ProjectRepository extends GraphRepository<Project> {
@Query(value="g.v(project).pid", type=QueryType.Gremlin)
String findProjectId(@Param("project") Project project);
}

The corresponding NodeEntity:
@NodeEntity
public class Project {
@GraphId Long internalId;
@Indexed(unique=true) String pid;
public Project(String pid) {
this.pid = pid;
}
}

"projectRepo.findProjectId(new Project("p019"));" returns "p019"
A "g.v(project).keys()" statements returns : [pid, type]
That's the normal case.

Now change the NodeEntity to:
@NodeEntity
public class Project {
@GraphId Long internalId;
@Indexed(unique=true) String id;
public Project(String id) {
this.id = id;
}
}
And the Gremlin query to: g.v(project).id

"projectRepo.findProjectId(new Project("p019"));" returns 29 (the internal GraphId, not the one you set). It should still return "p029".
A "g.v(project).keys()" statements returns : [id, type]


Affects: 2.1.M1

Reference URL: https://groups.google.com/d/topic/neo4j/uVEOBQYVwm8/discussion

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Mar 15, 2012

Michael Hunger commented

This is not a bug in SDN, it stores your id field as "id" property in Neo4j,
you should use v.getProperty("id") in gremlin in this case (which is also faster than v.id).

@spring-projects-issues spring-projects-issues added status: invalid in: core labels Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core status: invalid
Projects
None yet
Development

No branches or pull requests

1 participant