If I declare a field to use the NoopAccessor (as the DB field isn't mapped to my pojo), is there a way to write to the field?
(background: I'm trying to historize records, for that the record itself gets copied to a new table which has one extra field containing the date, when the record got historized; the mapping with the NoopAccessor was done by someone working on it before, and as I understand, the NoopAccessor gets used when you have a DB field that isn't mapped to a pojo).
What I am trying now, is to write an interceptor which will put the current date into the historized date field, which is present in the state[] and propertyNames[] arrays of the onSave method in the interceptor. But if I store the current time into the state, after writing, the DB record still shows the timestamp as 'null' (but the interceptor is otherwise working fine; I changed it to also write something to a different mapped field for a test run, and THAT field showed up in the DB as expected, with the timestamp still being null - though both were written at the same time by the same method.).
Does the NoopAccessor also 'prevent' these records being written? Is there another way how this could be done (I do not want to subclass all the records I need to historize just to include the timestamp as a field - nor do I want to generally add the field to the model -- and the model already exists and has some data in it, so I can't easily change the existing DB setup as it would also touch on a lot of other things...)?
Any ideas what might be causing this issue (i.e. is it due to how the NoopAccessor works, or is there (potentially) some other issue at work?) or how it could be circumvented?
|