Opened 9 years ago

Closed 9 years ago

#1989 closed defect (fixed)

Change history logging doesn't log old values for date annotations

Reported by: Nicklas Nordborg Owned by: everyone
Priority: critical Milestone: BASE 3.7.1
Component: core Version:
Keywords: Cc:

Description

For some reason it seems like the change history log is missing the old values when modifying an annotation of date type.

Other annotation types (strings, numbers, etc.) seems to work and so do regular property value (including dates).

Change History (5)

comment:1 by Nicklas Nordborg, 9 years ago

It was not so difficult to find out why this was happening. Keeping track of the old values is implemented in ParameterValueData (line 143-163). The DateParameterValueData (line 83-99) overrides the method in the superclass and is thereby bypassing the change history logging.

I think we should make the method in ParameterValueData final so that it can't be overridden in subclasses. Then we need to find another solution for the requirements for the DateParameterValueData class.

comment:2 by Nicklas Nordborg, 9 years ago

(In [7091]) References #1989: Change history logging doesn't log old values for date annotations

This fixes the issue with not logging the old date values. Subclasses that modify the current values must call storeCurrentValuesAsOld() to make sure that the old values are logged.

comment:3 by Nicklas Nordborg, 9 years ago

The first idea that the method should be final was tried but turned out to not work. The reason is that Hibernate is not happy with final methods when they are combined with lazy initialization. It turned out that the logging stopped working for all types of values. The reason seemed to be that we suddenly had two different ParameterValueData instances representing the same entry in the database. One of the instances saved the old values just as expected, but when Hibernate got hold if it the other instance was used that didn't have the old values.

comment:4 by Nicklas Nordborg, 9 years ago

(In [7092]) References #1989: Change history logging doesn't log old values for date annotations

Added schema update that tries to fix missing old values by using the 'new values' from the previous log entry.

comment:5 by Nicklas Nordborg, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.