Finalize JPA Entity Relationships (SZ-24)
rk@tigase.net opened 3 weeks ago

Summary

Define and annotate the entity relationships among domain objects (User, Project, Issue, PullRequest, GitRepo, etc.) to reflect real-world associations cleanly and correctly.

This step ensures the domain model is semantically connected, navigable via JPA, and aligned with production-ready behavior such as lazy-loading, cascade rules, and cyclic reference handling.


Acceptance Criteria

  •  Add @OneToMany, @ManyToOne, @ManyToMany mappings with mappedBy and fetch where applicable
  •  Introduce inverse navigation fields as needed (e.g., User.reportedIssues, User.assignedIssues)
  •  Ensure bidirectional consistency for:
    • UserRole
    • UserProject
    • ProjectIssue, GitRepo, PullRequest
    • IssueIssueComment
    • PullRequestreviewers, relatedIssue, gitRepo
  •  Add appropriate cascade settings (e.g., cascade delete for issue comments)
  •  Annotate @JsonIgnore on bidirectional relationships to avoid cyclic serialization
  •  Ensure all entity classes compile and can be saved/loaded in tests

Notes

  • Use FetchType.LAZY for most @OneToMany and @ManyToMany fields to avoid N+1 query problems
  • Consider whether PullRequest should belong to Project or GitRepo — decide and apply consistently
  • Relationships should remain semantically minimal — avoid "everything links to everything" bloat

Work Estimate

TaskEstimated Time
Map relationships and annotate models1.5 hrs
Add @JsonIgnore or DTOs for cyclic refs30 min
Rebuild and fix all compilation/test breakage1 hr
Git hygiene (commit, push, PR)15 min

Total Estimate: ~3–3.25 hours


  • rk@tigase.net changed fields 3 weeks ago
    Name Previous Value Current Value
    Type
    New Feature
    Improvement
issue 1 of 1
Type
Improvement
Priority
Normal
Assignee
Version
1.0
Sprints
n/a
Customer
n/a
Issue Votes (0)
Watchers (3)
Reference
SZ-24
Please wait...
Page is in error, reload to recover