eclipse-ee4j / eclipse-ee4j/jersey
Declarative Linking: Support @InjectLinkNoFollow on class level
- Dominant language
- Java
- Stars
- 730
- Forks
- 382
- PR merge metrics
- No merged PRs in 30d
Description
When an entity (lets call it parent) in my application links to a collection of entities associated with the parent entity, the declarative linking follows all fields of parent, to check those entities for other links (that's how I understand it).
This causes all lazy loaded collections to get loaded, even if they are not serialized into json format. So I end up with a huge amount of DB queries.
I could avoid this scenario by annotating every field of an entity with @InjectLinkNoFollow but this is impracticable. In fact, all fields of all my models would need to be annotated.
It should be possible, at least, to annotate a class with this annotation to avoid the traversal of associated entities. Or, the traversal of related entities is turned off by default.
A rudimentary fix would be this: [https://github.com/jersey/jersey/compare/master...weaselmetal:release-2.19](https://github.com/jersey/jersey/compare/master...weaselmetal:release-2.19)
#### Affected Versions
[2.19]
Contributor guide
Research direction
Start by locating Jersey's declarative linking implementation and the handling of @InjectLinkNoFollow, then compare the behavior with the linked 2.19 branch diff. Determine how class-level annotation support should prevent traversal of associated entities, and verify that the affected lazy-loaded collections are no longer traversed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100