refactor(metadata): make bookId and authorId/categoryId/shelfId final and adjust constructors#968
Conversation
… and adjust constructors
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🧰 Additional context used📓 Path-based instructions (1)backend/src/**/*.java📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (4)📓 Common learnings📚 Learning: 2026-04-10T08:15:37.436ZApplied to files:
📚 Learning: 2026-04-14T12:43:08.698ZApplied to files:
📚 Learning: 2026-04-04T15:36:56.558ZApplied to files:
🔇 Additional comments (3)
📝 WalkthroughWalkthroughThree composite key entity classes are refactored to enforce immutability by making ID fields Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Linked Issue: Fixes #
Changes
This pull request refactors the key classes used as composite primary keys in the entity model to improve immutability and encapsulation. The main changes are making the fields final, restricting the no-args constructor's access, and removing unnecessary setters.
Entity key class improvements:
bookIdand the related key fields (authorId,categoryId,shelfId) final inBookMetadataAuthorKey,BookMetadataCategoryKey, andBookShelfKeyto ensure immutability.@NoArgsConstructorto haveaccess = AccessLevel.PROTECTED, force = truein all three key classes, restricting instantiation and ensuring compatibility with JPA.@Setterannotation from all key classes, preventing modification of fields after construction.Summary by CodeRabbit