Named Entity Graphs Naming Scope in Spring Data


Named Entity Graphs Naming Scope in Spring Data
I've recently discovered Named Entity Graphs, and I'm trying to implement them in a clean, DRY way.
What I'm not sure about (and reading through the JPA and Spring Data Docs hasn't answered) is the scope of the names used. Are the private to the classes they're defined in, or can I do something like this:
@Entity
@NamedEntityGraphs(
@NamedEntityGraph(name = "Route.deep",
attributeNodes =
@NamedAttributeNode(value = "stops", subgraph = "Stop.deep ")
)
)
public class Route ...
@Entity
@NamedEntityGraphs(
@NamedEntityGraph(name = "Stop.deep",
attributeNodes =
@NamedAttributeNode(value = "records")
)
)
public class Stop ...
Where the Stop.deep subgraph in Route refers to the named entity graph in Stop.
Thanks!
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Comments
Post a Comment