I went through several Spring / AOP tutorials and got a little familiar with the relevant concepts.
Now, coming to my requirements, I need to create an Activity Log implementation that saves the actions of a registered user in the database, which can vary from applying for a service or creating new users in case of users Admin, etc. When calling any method that has an annotation (say @ActivityLog), this information should be stored in the form of actorId, actionComment, actionTime, actedUponId, ... etc.
Now, if I create a POJO class (which is displayed in a table ActivityLogin the database) and want to save this data from Advice(preferably using the same transaction as the method, the method uses the @Transactionalannotation), how do I actually populate the variables in this POJO? I can probably get actorIdfrom the session object, or actionTimemaybe just be new Date(), but what about dynamic values for actionComment/ actedUponId?
Any help would be brilliant! (By the way, I have a requirement not to use Hibernate Interceptors.)
Sumit source
share