How to limit the depth of the @Fetch annotation in Spring data neo4j -
i know @fetch annotation can used load nodes on other sides of relationships. normally, appears id of foreign node loaded, , not properties.
is there way limit depth of @fetch first neighbor loaded, , no further? in heavily connected graph, don't want load entire graph of course, minimize number of calls server, it's useful first level of connected nodes included in response.
currently there no way of limiting depth, @fetch
goes along next object , if 1 has again @fetch
annotations continue load. might not have been wisest decision so, that's way in sdn3.
in sdn4 have option specify depth parameter load , store methods.
i'm not big fan of navigation / loading of nested structures via domain objects.
that's why i'd rather recommend nested loading write use-case specific cypher query load data need , project dto annotated @queryresult
part of repository method.
interface movierespository extends graphrepository<movie> { @query("match (n:actor)-->(m:movie) return n.name name,collect(m.title) titles") list<filmography> listfilmographies(pageable page); } @queryresult class filmography { string name; list<string> titles; }
Comments
Post a Comment