[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - EJB3 way of recreating Xdoclet's @jboss.audit feature?
smithmb
do-not-reply at jboss.com
Tue Mar 25 22:54:25 EDT 2008
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;
or injecting session beans with @EJB doesn't work!
The only thing with access to the context is a session bean, and I'm not even sure I *can* make a session bean into an entity listener. Please help!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4138845#4138845
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4138845
More information about the jboss-user
mailing list