cuba-platform/cuba

EntityLog isn't registered for objects that are modified in EntityChangedEvent

andreysubbotin opened this issue · 0 comments

Environment

  • Platform version: 7.2.*

Description of the bug or enhancement

Minimal reproducible example

  • Create Company entity with name and description attributes.
  • Create listener for EntityChangedEvent
   @EventListener(phase = TransactionPhase.BEFORE_COMMIT)
    public void beforeCommit(EntityChangedEvent<Company, UUID> event) {

        Company company = transactionalDataManager.load(event.getEntityId())
                .view(View.BASE)
                .optional()
                .orElse(null);

        if (event.getType() == EntityChangedEvent.Type.CREATED) {
            if (company != null) {
                company.setDescription(company.getName());
                transactionalDataManager.save(company, companyLog);
            }
        }
    }
  • Enable entity log for Company entity.
  • Try to create Company entity. Fill only name attribute.
  • Check entity log for created entity.
  • Expected behavior
    The change log should contain name and description attributes.
  • Actual behavior
    The change log contain only name attribute. The description attribute that was changed by listener, was not registered in EntityLog.