http://glassfish.java.net/javaee5/ejb/EJB_FAQ.html


What is therelationship between @EJB and ejb-ref/ejb-local-ref?

The @EJB annotationand the ejb-ref/ejb-local-ref .xmlelements
are used to specify the same semantic information. Specifically, that a Java EE component has adependency on a local or remote EJB component. Every @EJB canbe
translated into an equivalent ejb-ref/ejb-local-ref.  @EJB iseasier
to use but it serves the same purposeas ejb-ref/ejb-local-ref. 
Here's a table with more details :

@EJB attribute
Description
Default value
ejb-refequivalent
ejb-local-refequivalent
name
Unique location within the private component namespace(java:comp/env). 
field-level : <fully-qualifiedname
of declaringclass>/<field-name>




method-level : <fully-qualifiedname
of declaring class>/<propertyname>




class level : name isrequired.
 
ejb-ref-name




ejb-ref-name




beanInterface
For EJB 3.x business interfaces, the Local or Remote businessinterface of the session bean.



For EJB 2.x, the Home/LocalHome interface of the session/entitybean.
field-level : the type of the declared field.



method-level : the type of the single setter parameter



class level : beanInterface isrequired.




For EJB 3.x :<remote>



For EJB 2.x :

<home>
For EJB 3.x : 

<local>



For EJB 2.x :

<local-home>
beanName
ejb-name (not global JNDI name)of
the target ejb component within the application.  This can be used whenever the target ejbcomponent is defined within the same application as the referencingcomponent, regardless of local vs. remote.   Theonly time it can't be used is if the @EJB refersto
a Remote interface (3.x or 2.x) that is defined outside theapplication.  
Automatically resolved if there is only one EJB component withinthe application that exposes  the valueof beanInterface
ejb-link
ejb-link
lookup



*(Added in EJB 3.1)

Specifies the portable JNDI nameof the
target EJB component to whichthis @EJB dependencyrefers.  
This should be usedinstead of mappedName incases
where an @EJB dependencyneeds to be resolved
to a Remote EJB component defined in adifferent application.  It can also be used tochain one @EJB dependencyto
another @EJB dependency. 
n/a
lookup-name
lookup-name
mappedName
Specifies the product-specific name of the target Remote EJBcomponent.  For GlassFish, this refers to theglobal JNDInameof
the target Remote EJB component.  



Not applicable for local interfacesbecause beanName canalways
be used instead.



*(Should not be used in EJB 3.1. See lookup instead)
If the target EJB component is defined within the same applicationand the beanNamedefaultapplies,
no additional mapping is required.



Otherwise, the target global JNDI namewill
be set to the value of beanInterface 
mapped-name
n/a


What is therelationship between @EJB and ejb-ref/ejb-local-ref?的更多相关文章

  1. 关于EJB,为什么用EJB?为什么不用EJB?

    http://blog.csdn.net/linxi1209163com/article/details/51029890 一:什么是EJB 官方说法,就是企业级是基于语言的服务器框架技术,通过我们可 ...

  2. EJB是什么?EJB的概念分析与理解(copy)

    [说明:转载于http://blog.csdn.net/jojo52013145/article/details/5783677] 1. 我们不禁要问,什么是"服务集群"?什么是& ...

  3. git pull报“unable to update local ref”解决方案

    使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误. 除了重新clone一份代码外,还可以使用如下解决方案: 1. ...

  4. git pull fails “unable to resolve reference” “unable to update local ref”

    问题 由于有人rebase了分支,或者不知道怎么搞的.其他人拉取代码的时候,发现拉不下来. >git fetch error: cannot lock ref 'refs/remotes/ori ...

  5. spring property标签中的 ref属性和ref 标签有什么不同? 如下:<property name="a" ref="b" />

    spring property标签中的 ref属性和ref 标签有什么不同? 如下:<property name="a" ref="b" /> sp ...

  6. [转]spring property标签中的 ref属性和ref 标签有什么不同

    spring property标签中的 ref属性和ref 标签有什么不同? 如下:<property name="a" ref="b" /> sp ...

  7. git pull时 git cannot lock ref XXXXXX (unable to update local ref)错误解决方案

    git pull :  git cannot lock ref    XXXXXX (unable to update local ref) pull代码的时候出现的错误,导致代码拉不下来. 看了一下 ...

  8. 使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误。

    使用git pull拉取代码的时候,无法拉取最新代码,报"unable to update local ref"错误. 除了重新clone一份代码外,还可以使用如下解决方案: .切 ...

  9. spring property标签中的 ref属性和ref 标签有什么不同

    spring的配置文件可能会有多个<property name="a" ref="b" />就是找当前配置文件里的bean 也就是b <ref ...

  10. spring 中<ref parent="">标签是什么意思;ref标签与ref属性有什么不同;子容器如何引用父容器的bean

    spring的配置文件可能会有多个<property name="a" ref="b" />就是找当前配置文件里的bean 也就是id为b的 < ...

随机推荐

  1. SGU 157.Patience

    简单的搜索,在n>10时,要打表 code: #include<stdio.h> #include<string.h> #include<algorithm> ...

  2. Queue学习

    Queue在Python中可以算作是一种容器,但是他和list,set,dict不一样. 1. Queue不是Python内置类型.它在Queue模块中定义. 2. 它不是iterator容器,他不能 ...

  3. absolut绝对定位的非绝对定位用法

    一.absolute绝对定位的流行用法 一般而言,我们会用absolute绝对定位做什么呢?就是绝对定位,顾名思意,定死在某个位置上.例如,lightbox效果就是使用的绝对定位,例如新浪微博的弹出提 ...

  4. uboot环境变量分析

    uboot的环境变量在程序的运行和调试过程中都发挥着比较重要的作用. 一.环境变量 可以理解为全局变量,但是他的生命周期比全局变量要长,当程序已经结束运行时,全局变量就会消亡,但是环境变量在下次上电运 ...

  5. Java高精度学习第二弹——求N!

    继续学习Java高精度,今天写的是求N!. 首先附上源代码: import java.util.Scanner; import java.math.BigInteger; public class M ...

  6. bzoj1855: [Scoi2010]股票交易

    Description 最近lxhgww又迷上了投资股票,通过一段时间的观察和学习,他总结出了股票行情的一些规律. 通过一段时间的观察,lxhgww预测到了未来T天内某只股票的走势,第i天的股票买入价 ...

  7. NSString 练习

        //将“⽂文艺⻘青年”改成“213⻘青年”.   NSString *str = @"文艺青年";   NSString *str1 = [str stringByRepl ...

  8. [转]加盐hash保存密码的正确方式

    0x00 背景 大多数的web开发者都会遇到设计用户账号系统的需求.账号系统最重要的一个方面就是如何保护用户的密码.一些大公司的用户数据库泄露事件也时有发生,所以我们必须采取一些措施来保护用户的密码, ...

  9. OPENFILER记下,有空再玩之,ISCSI,以后网络起来了,速度还是应该可以的

  10. 根据div 标签 查看数组@class=modulwrap 下面的/table/tbody/tr/td

    <div class="modulwrap"> <div class="request_title"> <span class=& ...