Hello folks,
Xdoclet has a feature where I can ask it to modify an entity bean with the correct last-updated time and last-modified-by user via the tag @jboss.audit (see the details at http://xdoclet.sourceforge.net/xdoclet/tags/jboss-tags.html).
I'm trying to use an @EntityListeners entry to do the same thing. Unfortunately, I have *no* way of accessing the current context, so I can't pull out the principal from it! If the entity listener callback *were* a session bean, this would be possible, but it isn't! (Should I make it one?)
Here's how I'm stuck:
public class VOEntityListener { @PrePersist public void prePersist(AbstractVO abstractVO) { // how do I get the session context? } }
@Resource private SessionContext ctx;
Can I modify these entities in an interceptor on a method in a session bean? Will I be able to access the entity bean in question from the interceptor? There's got to be a way to duplicate this functionality from EJB2!