Project

General

Profile

Actions

Defect #2122

closed

Notification configuration can't be displayed after deleting a template which uses some notification configuration (missing integirity)

Added by Vít Švanda almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Ondrej Husník
Category:
Automatic roles
Target version:
Start date:
03/17/2020
Due date:
% Done:

100%

Estimated time:
Affected versions:
Owner:

Description

Tested on version 10.2.0-SNAPSHOT

Steps to reproduce:
  • create an template
  • create an notification configuration uses this template
  • remove the template.
  • try to display Notification -> Configuration:

Log:

org.springframework.orm.jpa.JpaObjectRetrievalFailureException: Unable to find eu.bcvsolutions.idm.core.notification.entity.IdmNotificationTemplate with id 7b3cdc7d-d705-4d88-9fe6-727ad5be3c8c; nested exception is javax.persistence.EntityNotFoundException: Unable to find eu.bcvsolutions.idm.core.notification.entity.IdmNotificationTemplate with id 7b3cdc7d-d705-4d88-9fe6-727ad5be3c8c
    at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:378)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:527)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)

Actions #1

Updated by Vít Švanda almost 5 years ago

Same situation is in the table "idm_notification", where relation to the deleted template remains. Please fix also this.

Workaround:


update idm_notification set notification_template_id = null where notification_template_id not in (select id from idm_notification_template);

update idm_notification_configuration set template_id = null where template_id not in (select id from idm_notification_template);

Actions #2

Updated by Ondrej Husník over 4 years ago

  • % Done changed from 0 to 70
Actions #3

Updated by Vít Švanda over 4 years ago

  • Target version changed from Rhyolite (9.7.17) to 10.2.0
Actions #4

Updated by Ondrej Husník over 4 years ago

  • Status changed from New to Needs feedback
  • Assignee changed from Ondrej Husník to Vít Švanda
  • % Done changed from 70 to 90

As a part of this task solution there was added event support to IdmNotificationTemplateDto. In created processor for create/update events there is added a logic permitting from deletion of used template and thereby breaking referential integrity too. User is warned about this.
Please provide me a feedback of this task.

https://github.com/bcvsolutions/CzechIdMng/pull/96/commits/16b88ebd0afb7c8c5808e98cfa488f3a82da17d2

Actions #5

Updated by Vít Švanda over 4 years ago

  • Status changed from Needs feedback to Resolved
  • Assignee changed from Vít Švanda to Ondrej Husník
  • % Done changed from 90 to 100

I did review and test. Works perfectly now. Code is very nice. Thanks for this fix.

Actions #6

Updated by Radek Tomiška over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF