[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-user
Subject:    [jboss-user] [EJB 3.0] - SessionContext from Entity
From:       agonnet <do-not-reply () jboss ! com>
Date:       2008-02-29 17:09:28
Message-ID: 21412075.1204304968748.JavaMail.jboss () colo-br-02 ! atl ! jboss ! com
[Download RAW message or body]

Q: Is there any way of accessing the SessionContext object of a session bean, which \
has created (in whatever way) an entity, from within the actual entity object?

Background:
In my app, when I insert or update rows via a entity created from a session EJB, I'd \
like to set a column to a user id derived from the caller Principal object (as \
returned by SessionContext.getCallerPrincipal( ) ). 

I could set this using code in all the session EJBs in every entity that's \
inserted/updated, but this line of code is easilly forgotten. 

If I could access the SessionContext from the entity class I could add the code there \
when writing the entity class and not every time I use it from a session EJB.

I've tried "@Resource SessionContext ctx;" in the entity, but this gives null.

Thanks!

View the original post : \
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133302#4133302

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133302
 _______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic