Hello,
I'm trying to find a way to solve this tricky problem.
I want to ensure that all modifications made on my EJB 3 entities are traced in a specific
column (or field).
I use a security context and I'd want to store the getSubject() and the current date
in two fields.
The idea is to get rid of the sessionContext (which contains the
sessionContext.getCallerPrincipal().getName()) before any (real) update or persist
operation.
I have tried to implement PreUpdate and PostUpdate with a method containing
lastModified=new Date(). But how to get the CallerPrincipal ?
It is ok when I use a ThreadLocal and propagate my context between the session bean and
the entity beans. But I use intensively Cascade merge/update operations. The @preUpdate
method is called whenever the field is really stored or not.
Is there a way to implement that use case as a simple SQL Trigger ?
Thank a lot
Yohan
ps : I have tested the tips in the Auditing chapter in Java Persistence book without
success
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157674#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...