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. 编码问题导致样式显示在IE中不正常

    今天在做项目的时候,遇到样式显示不正常的问题,结果是因为用系统自带的notepad编辑器编辑文件时,编码格式被更改了.我们需要在Notepad++中,将编码格式改成Encode inUTF8 with ...

  2. yum安装ftp服务器

    1.安装vsftp,本文采用yum安装: #yum install vsftpd 2.安装后运行: # service vsftpd restart Shutting downvsftpd:      ...

  3. PHP 关于MongoDB的操作

    <?php header("Content-type:text/html;charset=utf-8"); $m = new MongoClient(); // 连接 $db ...

  4. php基础知识【oop/mvc/orm/aop】

    OOP 面向对象编程是一种计算机编程架构.OOP 的一条基本原则是计算机程序是由单个能够起到子程序作用的单元或对象组合而成.OOP 达到了软件工程的三个主要目标:重用性.灵活性和扩展性.为了实现整体运 ...

  5. cocos2dx调度器scheduler

    / 让帧循环调用this->update(float dt)函数 // scheduleUpdate(); // 让帧循环去调用制定的函数,时间还是1/60秒 // schedule(sched ...

  6. run_command函数分析

    一.概述 位置:common/main.c 功能:根据传入参数(命令),在命令存储区(.u_boot_cmd)中查找对应的命令,找到命令并调用对应的函数执行 流程: 二.分析 1.函数说明信息 /** ...

  7. Tag Helpers 介绍

    Tag Helpers 介绍 原文:Introduction to Tag Helpers作者:Rick Anderson翻译:刘浩杨校对:高嵩(Jack) 什么是 Tag Helpers? Tag ...

  8. iOS开发工程师笔试题

    iOS开发工程师笔试题 1.   Object-c的类可以多重继承么?可以实现多个接口么?Category是什么?重写一个类的方式用继承好还是分类好?为什么? Object-c的类不可以多重继承:可以 ...

  9. 2D地图随机生成

    2D地图随机生成基础绘图 海陆分布

  10. java打jar包 命令行cmd在当前路径打jar包

    不尝试就永远不会知道真相. 今天搞webservice,需要将服务单独拉出来发布.打jar包的时候要打成aar包,所以用到cmd下的打jar包的命令. 当前路径打jar包,一定要先进到这个文件夹,然后 ...