Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between name , beanName and mappedName attributes for annotation @EJB?

What is the difference between name, beanName and mappedName attributes for annotation @EJB in EJB3.0?
I found this on net at following link - http://www.tutorialspoint.com/ejb/ejb_annotations.htm

  • name - Used to specify name which will be used to locate the referenced bean in environment.
  • beanName - Used to provide name of the referenced bean.
  • mappedName - Used to specify the JNDI name of the referenced bean.

How do the name in name and beanName attribute differ ?

like image 766
Jagdish Chandra Avatar asked Sep 30 '22 02:09

Jagdish Chandra


1 Answers

The @EJB declares an EJB reference from your component to a target EJB. The name is the key of the reference in your component environment. There are several ways to specify the target EJB:

  1. The beanName (or <ejb-link> in XML) can be used to specify the target EJB if the EJB is located in the same application as your component
  2. The mappedName is a non-portable, vendor-specific string (even though it's part of the standard!) that somehow identifies the target.
  3. In EJB 3.1, the lookup is a portable way to specify a JNDI string of the target.
  4. Vendor-specific mechanisms, such as binding files.
  5. If none of the other mechanisms are used, then the javadoc says the @EJB will target an EJB in the same application that implements the target type if there is only one.
like image 169
Brett Kail Avatar answered Oct 06 '22 19:10

Brett Kail