jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
560 stars 121 forks source link

The values of the deleted dynamic attribute are not deleted #3720

Open fractal3000 opened 1 day ago

fractal3000 commented 1 day ago

Environment

Jmix version: last version

Bug Description

The values of the deleted dynamic attribute are not deleted. So the attribute values are accessible with the EntityValues.getValue and EntityValues.setValue methods.

Steps To Reproduce

  1. Create any project with the dynamic attributes add-on
  2. Create an entity
  3. Create a view for the enity
  4. Add a dynamic attribute for the entity(name - dynAttr1, code - category1DynAttr1) and add it to the view.
  5. Apply the dynamic attributes changes.
  6. Set some value for the attribute via UI
  7. Delete the attribute.
  8. Create a new dynamic attribute (name - dynAttr2, code - category1DynAttr2)
  9. Appy changes.
  10. Put some value to the new attribute.
  11. Create a screen with the buttons and contols that provide an ability to load and to set dynamic attriubute values.
  12. Check if there is the ablity to read and to write the value of deleted attribute

Current Behavior

The deleted attribute should is accessible.

Expected Behavior

The deleted attribute should be unaccessible.

Sample Project

DynamicModelTest.zip

fractal3000 commented 1 day ago

The loading of the attributes' values is implemented in io.jmix.dynattr.impl.DynAttrManagerImpl#findValuesByEntityIds

fractal3000 commented 1 day ago

The solutions might be

  1. To delete the attribute values when the attribute owner have been deleted.
  2. No to load all values. To take into a part current the dynamic attribute schema state during values loading.