-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Data Migration: Setter changes are persisted before data verification checks #12779
Labels
c.Bug
Bug/defect report
committers only
Difficult; better left for committers or more senior developers
Milestone
Comments
cedricongjh
added
committers only
Difficult; better left for committers or more senior developers
c.Bug
Bug/defect report
labels
Feb 25, 2024
The only solutions I can think of are to validate before using the setters, or evicting the object from the session cache.
See also: |
mingyuanc
added a commit
that referenced
this issue
Jul 8, 2024
* Fix notifications update logic * Add required mocks --------- Co-authored-by: Ching Ming Yuan <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
c.Bug
Bug/defect report
committers only
Difficult; better left for committers or more senior developers
In some logic class methods,
db.updateEntity()
method, which then performs the verification checks.For example:
teammates/src/main/java/teammates/sqllogic/core/FeedbackQuestionsLogic.java
Lines 193 to 211 in b697768
teammates/src/main/java/teammates/sqllogic/core/FeedbackResponsesLogic.java
Lines 205 to 214 in b697768
However, according to the Hibernate documentation, changes made by the setters are automatically persisted into the database, even though the new values could be invalid and fail the verification checks. This results in the database entity being polluted with invalid data.
I've tested this locally on
NotificationsLogic.updateNotification
:teammates/src/main/java/teammates/sqllogic/core/NotificationsLogic.java
Lines 81 to 90 in b697768
The update fails, but the entity retrieved from the database afterwards is still updated with invalidLongTitle.
The text was updated successfully, but these errors were encountered: