spring-projects / spring-data-neo4j

Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
http://spring.io/projects/spring-data-neo4j
Apache License 2.0
825 stars 619 forks source link

SDN 5.1.5 FindById does not take into account the depth [DATAGRAPH-1211] #1772

Closed spring-projects-issues closed 3 years ago

spring-projects-issues commented 5 years ago

umuzammil opened DATAGRAPH-1211 and commented

SDN 5.1.5. When we are trying to find node entity by id with usage “findById(4202L)” it returns empty optional. However when I execute “findAll()” I receive a proper result of all found entities. After that another call to “findById(4202L)” returns the entity as it should however it does not take into account the depth so execution of “findById(4202L)” and “findById(4202L, 2)” have the same result (nested objects are not populated). It looks like “findById” returns a cached result from “findAll”. What might be the issue here


Affects: 5.1.5 (Lovelace SR5)

Reference URL: https://trello.com/c/HSxtllxv/169-s3dxc-sdn-515-findbyid-does-not-take-into-account-the-depth

michael-simons commented 3 years ago

As answered in the referenced, internal Trello card: There was an issue with the domain mapping, the @Id annotation was not correctly used, therefor the findById derived method did not work.

With regards to the depth annotation: If an entity is already fully hydrated in the session cache, it will be used as is. The depth annotation is a mean to avoid traversing the whole graph. If the later has already been done, it is used.