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

Apply EntityGraph Definition on Query Method #752

Open
hantsy opened this issue May 30, 2024 · 4 comments
Open

Apply EntityGraph Definition on Query Method #752

hantsy opened this issue May 30, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@hantsy
Copy link

hantsy commented May 30, 2024

Specification Version

1.0.0-RC1

Bug report

If possible to apply the Entity Graph definitions on Entities to a specific query method in the Repositories? Spring Data JPA provides similar features for developers.

Additional information

For example,

@Entity
@NamedEntityGraph(name="with-comments")
class Post{
   @OneToMany
   Set<Comment> comments
}
interface PostRepository {

    @Find
    @EntityGraph(name="with-comments")
    Post findById(Long id);
}
@hantsy hantsy added the bug Something isn't working label May 30, 2024
@gavinking
Copy link
Contributor

This is not in the spec, since it would be a very Java Persistence-specific feature.

Also, the annotations for defining named entity graphs are super-ugly and I'm not a fan of them at all.

We do already have a very similar feature to this in Hibernate Data Repositories, but it uses Hibernate's named fetch profiles stuff, which have a much more elegant annotation-based definition.

@gavinking
Copy link
Contributor

(When we define integration with Jakarta Persistence, this is something we can look at.)

@hantsy
Copy link
Author

hantsy commented May 31, 2024

Yes, it should be part of the JPA integration, but it seems there is no a JPA extended spec jakarta-data-jpa under Jakarta Data.

@njr-11
Copy link
Contributor

njr-11 commented May 31, 2024

Jakarta Data is only in its 1.0 version. It is not a bug that Jakarta Data does not offer the suggested function. This issue should be an enhancement request, not a bug.

@mswatosh mswatosh added enhancement New feature or request and removed bug Something isn't working labels May 31, 2024
@mswatosh mswatosh changed the title [Bug]: Apply EntityGraph Definition on Query Method Apply EntityGraph Definition on Query Method May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants