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
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: