JBoss 5.0.0.GA

Hi,

I'm exhausted searching for some enlightenment on whether the attribute 
"mappedName" in @EJB is needed or not in a JSF Managed Beans. Could please 
anyone enlighten me on this subject? I'm getting error message like "Resolution 
should not happen via injection container" if I don't specify mappedName. I 
want to avoid mappedName as much as possible. Or is it unavoidable?

Also, what's the difference between applying @EJB to field from applying to a 
class? Consider the following example:

@Stateless
  | @EJB(name="audit", beanInterface=AuditLocal.class)
  | public class MyBean implements MyBeanRemote, MyBeanLocal {
  |   
  |   SessionContext context;
  |   AuditLocal audit;
  |   
  |   public void setSessionContext(SessionContext context) {
  |     this.context = context;
  |   }
  | 
  |   @PostConstruct
  |   public void init() {
  |     audit = (AuditLocal) context.lookup("audit");
  |   }
  |   // ...
  | }

My guess is, if @EJB is declared at the class level, the container tries to 
inject the session bean into java:/comp/env/audit JNDI name instead of 
injecting it to the field directly as opposed to @EJB that is declared at the 
field level. Did I get it right?

And it knows what EJB to inject in java:/comp/env/audit by relying on the value 
of beanInterface attribute, is that right?

Thanks




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

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

Reply via email to