ScreenHistorySupport framework class assumes all entities have id of type UUID

As the title implies, @TrackEditScreenHistory cannot be applied on entities without an UUID id.

To my knowledge this isn’t mentioned in the class annotations page in the docs:
https://doc.cuba-platform.com/manual-6.9/entity_class_annotations.html

The culprit is the following line of code (line 88 in ScreenHistorySupport.java):

88: entityId = (UUID) entity.getId();

The cast raises an exception if the ID is not of type UUID.
Either raise an unsupported exception earlier in the execution path if the attribute is applied on an incompatible entity, or refactor the tracking code to save the ID as a varchar, or create a column for each supported ID type (like UUID_ID, INT_ID and so on).

Paolo

1 Like

Hi Paolo,

Thank you for pointing out the problem.
Created issue: ScreenHistorySupport assumes all entities have id of type UUID · Issue #1261 · cuba-platform/cuba · GitHub