SONARJAVA-6537 Implement rule S8948: "@OneToMany" relationships should use "mappedBy" or "@JoinColumn"#5716
Conversation
romainbrenguier
left a comment
There was a problem hiding this comment.
There are a couple of changes to make on the rspec side, otherwise it looks good.
| <li>Hibernate ORM User Guide - Associations - <a | ||
| href="https://docs.jboss.org/hibernate/orm/6.2/userguide/html_single/Hibernate_User_Guide.html#associations">Comprehensive guide to Hibernate | ||
| associations including one-to-many mappings</a></li> | ||
| <li>Baeldung - JPA @OneToMany Annotation - <a href="https://www.baeldung.com/jpa-one-to-many">Practical tutorial on using @OneToMany with mappedBy |
There was a problem hiding this comment.
I get a page not found on this link
| <li>Jakarta Persistence Specification - OneToMany - <a | ||
| href="https://jakarta.ee/specifications/persistence/3.1/jakarta-persistence-spec-3.1.html#a11914">Official specification for @OneToMany annotation | ||
| and its default behavior</a></li> | ||
| <li>Hibernate ORM User Guide - Associations - <a |
There was a problem hiding this comment.
The format for the links in documentation should be: - <source> - <url>[<title>]. In this example the title should be Hibernate ORM User Guide.
Code Review 👍 Approved with suggestions 1 resolved / 2 findingsImplements rule S8948 to detect missing 'mappedBy' or ' 💡 Edge Case: Property-access
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
Code Review ✅ Approved 2 resolved / 2 findingsImplements rule S8948 to enforce the use of 'mappedBy' or ' ✅ 2 resolved✅ Edge Case: Explicit @jointable on @onetomany flagged as noncompliant
✅ Edge Case: Property-access @onetomany (getter) not detected
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
Code Review ✅ Approved 2 resolved / 2 findingsImplements rule S8948 to enforce the use of 'mappedBy' or ' ✅ 2 resolved✅ Edge Case: Explicit @jointable on @onetomany flagged as noncompliant
✅ Edge Case: Property-access @onetomany (getter) not detected
OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |




Summary by Gitar
S8948to detect@OneToManyrelationships missingmappedByor@JoinColumnconfigurations.jakarta.persistenceandjavax.persistenceAPIs.S8948in theSonar_wayquality profile.This will update automatically on new commits.