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. 《du命令》-linux命令五分钟系列之三

    本原创文章属于<Linux大棚>博客. 博客地址为http://roclinux.cn. 文章作者为roc 希望您能通过捐款的方式支持Linux大棚博客的运行和发展.请见“关于捐款” == ...

  2. sed 简明教程

    做个标记 http://coolshell.cn/articles/9104.html sed全名叫stream editor,流编辑器,用程序的方式来编辑文本,相当的hacker啊.sed基本上就是 ...

  3. phpcms v9用get-sql调用数据表中的图组图片示例代码

    {pc:get sql="SELECT pictureurls FROM phpcms_picture_data where id = $id" start="0&quo ...

  4. JQuery解析XML数据的几个例子

    用JavaScript解析XML数据是常见的编程任务,JavaScript能做的,JQuery当然也能做.下面我们来总结几个使用JQuery解析XML的例子. 第一种方案: <script ty ...

  5. Linux删除用户

    删除用户 # userdel abc 该删除操作将用户删除但保留用户的home文件夹和邮件文件夹.并且当用户abc正在登录的时候,删除操作将失败,如下: # userdel abc userdel: ...

  6. Delphi中停靠技术的实现

    随着软件技术的不断进步,软件界面也越来越美观,操作也越来越方便.综观市面上比较专业的各种软件,我们会发现大部分都提供窗体停靠的功能,特别象工具软件,基本上都或多或少有停靠功能.自然,Delphi也支持 ...

  7. E题 - A+B for Input-Output Practice (IV)

      Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description You ...

  8. ha666_go运行环境配置

    项目地址:http://git.oschina.net/ha666/ha666_go 服务器配置: CPU: 1核 内存: 1024 MB 操作系统: CentOS 7.0 64位 内网IP: 10. ...

  9. ComponentOne的C1Chart做饼状图怎么显示其百分比

    问题:ComponentOne的C1Chart做饼状图怎么显示每部分的百分比 描述: 我用C1Chart做饼状图的时候,不知道怎么显示其百分比在对应的区域上,求解. 目前做的效果(附加代码所生成的饼状 ...

  10. TControl.WMLButtonUp的inherited的作用——是为了给子类控件新的处理消息的机会

    意外注意到这个小细节: procedure TControl.WMLButtonUp(var Message: TWMLButtonUp); begin inherited; // 注意,如果是直接点 ...