jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
207 stars 59 forks source link

Improve Entity Graph annotations #98

Closed lukasj closed 9 years ago

lukasj commented 9 years ago

Entity Graphs was a needed feature in the JPA spec and it's great to have them.

But, they seem to verbose when you have more than just the simple case. Look at this example:

https://github.com/javaee-samples/javaee7-samples/blob/master/jpa/entitygraph/src/main/java/org/javaee7/jpa/entitygraph/Movie.java

My suggestion would be to allows them to be used as Meta-Annotations, like I describe here: http://www.radcortez.com/annotations-annotations-everywhere/

Or have a simplified form, where you could just do:

@NamedEntityGraph(
    attributes = {"id", "name", "description", "subgraph.property", "anotherSubgraph.property"}
)
lukasj commented 6 years ago
lukasj commented 9 years ago

@glassfishrobot Commented Reported by radcortez

lukasj commented 9 years ago

@glassfishrobot Commented @lukasj said: A dup of #43

lukasj commented 9 years ago

@glassfishrobot Commented neilstockton said: Well, the meta annotations is a dup of that other issue, but the "simplified form" is certainly not. How the heck is that Meta-Annotations describable as "simplified"????!!! Verbosity overload

lukasj commented 9 years ago

@glassfishrobot Commented @lukasj said: I moved the second part of the issue into its own #118

lukasj commented 9 years ago

@glassfishrobot Commented oliver.gierke said: I agree with Neil herre that the simplification is still worth pursuing. It might have not been a good idea to mention both these aspects in a single ticket? Can we maybe re-open the ticket and rephrase the summary to concentrate on the simplification aspect?

Regarding the matter at hand: the simplification is something I've been proposing ever since the first draft of the @EntityGraph proposal. However the proposal was rejected causes it apparently "introduces more complexity" – something that never really resonated with me but it's great that other seem to see a need for simplification here, too.

In Spring Data JPA, we basically already added that functionality on the repository level and build a simplified entity graph on the fly. See this blog for more details.

lukasj commented 9 years ago

@glassfishrobot Commented Issue-Links: duplicates JPA_SPEC-43

lukasj commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-98

lukasj commented 9 years ago

@glassfishrobot Commented Marked as duplicate on Monday, September 28th 2015, 10:53:07 pm