-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: NoopAccessor and Interceptors
PostPosted: Mon Nov 09, 2009 6:40 pm 
Newbie

Joined: Mon Nov 09, 2009 6:11 pm
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.