persistence
persistence copied to clipboard
Consider allowing @NamedEntityGraph at the method level
I would love to be able to write a Jakarta Data repository method like this:
@Find
@NamedEntityGraph(attributeNodes =
{@NamedAttributeNode(Author_.ADDRESS),
@NamedAttributeNode(Author_.BOOKS)})
Author author(String ssn);
But this doesn't work right now, because NamedEntityGraph is constrained to @Target({TYPE}).
I think we should consider relaxing that constraint to allow @NamedEntityGraph in other locations (e.g. package descriptors and methods).
An objection to this proposal could be that NamedEntityGraph is a bad name for this usage pattern, and that the annotation is generally quite verbose.
@njr-11