Defect #2159
closed
Notification agenda can't be read when Sender identity is deleted - missing referential integrity
Added by Ondrej Husník over 4 years ago.
Updated over 4 years ago.
Description
Notification agenda can't be read when Sender identity is deleted. Recipient identity seems to be OK
- Status changed from New to Needs feedback
- Assignee changed from Ondrej Husník to Radek Tomiška
- % Done changed from 0 to 90
- Status changed from Needs feedback to In Progress
- Assignee changed from Radek Tomiška to Ondrej Husník
- % Done changed from 90 to 70
I did code review. I'm not sure updating all notification recipients is the good way. There is a lot of notifications and their recipient (10k in my database - e.g. notifications for managers with more subordinates). Add please annotation @NotFound(action = NotFoundAction.IGNORE) instead of updating all recipients - meaning remains the same.
- Status changed from In Progress to Needs feedback
- Assignee changed from Ondrej Husník to Radek Tomiška
Following the review results, the approach to ref. integrity maintaining was changed. Annotation @NotFound(action = NotFoundAction.IGNORE) now works as prevention from hibernate exception throwing.
Unfortunately, during my attempt to modify created test, I wasn't able to break it even though above mentioned annotation was removed and Identity, previously set as identitySender to IdmNotificationDto, was also deleted. Calling 'find' method of the IdmNotificationLogService doesn't throw (actually Hibernate itself) expected exception.
Please, could you check my test and try to reproduce it on your environment? @NotFound(action = NotFoundAction.IGNORE) is necessary to remove first. Thank you in advance.
https://github.com/bcvsolutions/CzechIdMng/pull/103/commits/48fce6dd9d9f7707039c7d929165982120dd0b48
- Status changed from Needs feedback to Resolved
- Assignee changed from Radek Tomiška to Ondrej Husník
- % Done changed from 70 to 100
I did test and code review, it works and code looks nice, thx!
About question above - hibernate context (~cache) is used here. If @Transactional annotation is removed (context has transaction scope by default), then notification is reloaded properly. This is side effect of this annotation usage, i didn't know about it (so annotation could be used just in place like this, where no logic is related, it could be dangerous otherwise). Edit: the behavior is same with or without @NotFound annotation, so it's about @Transactional behvior itself.
Merged into develop with some trivial review notes:
https://github.com/bcvsolutions/CzechIdMng/pull/103/commits/507cf7d4ddb0244e2e0ad17b78b6025249c5e67a#diff-492aaae7554afb2d5b50c002154be612
- Tracker changed from Task to Defect
- Status changed from Resolved to Closed
Also available in: Atom
PDF