Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityGraph and Subgraph need an addPluralSubgraph() operation #411

Closed
gavinking opened this issue May 19, 2023 · 1 comment
Closed

EntityGraph and Subgraph need an addPluralSubgraph() operation #411

gavinking opened this issue May 19, 2023 · 1 comment

Comments

@gavinking
Copy link
Contributor

gavinking commented May 19, 2023

The following code does not pass the typechecker:

var graph = em.createEntityGraph(Book.class);
graph.addSubgraph(Book_.publisher);
graph.addSubgraph(Book_.authors).addSubgraph(Author_.person);

So we need to add a method which lets us write:

var graph = em.createEntityGraph(Book.class);
graph.addSubgraph(Book_.publisher);
graph.addPluralSubgraph(Book_.authors).addSubgraph(Author_.person);

Its signature is:

<X> Subgraph<X> addPluralSubgraph(PluralAttribute<? extends T, ?, X> attribute)

and it needs to be declared on both EntityGraph and Subgraph.

I had never noticed this oversight before, but actually it's pretty bad if you're trying to use the typesafe API.

gavinking added a commit to gavinking/persistence that referenced this issue May 19, 2023
gavinking added a commit to gavinking/persistence that referenced this issue May 19, 2023
gavinking added a commit to gavinking/persistence that referenced this issue Jun 29, 2023
@gavinking
Copy link
Contributor Author

Actually perhaps this should be called addElementSubgraph() to be more consistent with addKeySubgraph().

@lukasj lukasj linked a pull request Jul 11, 2023 that will close this issue
@lukasj lukasj closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
gavinking added a commit to gavinking/persistence that referenced this issue Aug 8, 2023
- fix incorrect generic signatures
- add way to navigate to collection elements

see jakartaee#424, jakartaee#411
gavinking added a commit to gavinking/persistence that referenced this issue Aug 9, 2023
- fix incorrect generic signatures
- add way to navigate to collection elements

see jakartaee#424, jakartaee#411
gavinking added a commit to gavinking/persistence that referenced this issue Aug 10, 2023
- fix incorrect generic signatures
- add way to navigate to collection elements

see jakartaee#424, jakartaee#411
lukasj pushed a commit that referenced this issue Aug 10, 2023
- fix incorrect generic signatures
- add way to navigate to collection elements

see #424, #411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants