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. python sklearn模型的保存

    使用python的机器学习包sklearn的时候,如果训练集是固定的,我们往往想要将一次训练的模型结果保存起来,以便下一次使用,这样能够避免每次运行时都要重新训练模型时的麻烦. 在python里面,有 ...

  2. 批处理文件安装与卸载Windows服务

    //安装Windows服务 将RECPost.exe和RECPostService替换成自己的项目名称和服务名称,并将文件保存成bat格式.其中%cd%是获取相对路径 @echo off set fi ...

  3. cocod2d-x 之 CCDirector、CCScene、CCSprite

    CCDirector是控制游戏流程的主要组件. typedef enum { /// sets a 2D projection (orthogonal projection)2D投机模式 kCCDir ...

  4. input里面的查找标记 ő

    <i id="J_SearchIcon" class="iconfont">ő</i> .iconfont {ont-family: i ...

  5. java-web-j2e学习建议路线

      JAVA学习之路(2)  首先要明白Java体系设计到得三个方面:J2SE,J2EE,J2ME(KJAVA).J2SE,Java 2 Platform Standard Edition,我们经常说 ...

  6. 【MySQL】SQL语法,between and 使用注意事项

    业务代码中有条查询学生姓名的sql: select stu_name from stu_info where stu_id between id_1 and id_2; 估计当时一时恍惚,拼接sql时 ...

  7. mysql中的group_concat函数的用法

    本文通过实例介绍了MySQL中的group_concat函数的使用方法,比如select group_concat(name) . MySQL中group_concat函数 完整的语法如下: grou ...

  8. 【HDOJ】2405 Marbles in Three Baskets

    BFS+状态压缩. /* 2405 */ #include <iostream> #include <queue> #include <cstdio> #inclu ...

  9. SQL Server判断对象是否存在 (if exists (select * from sysobjects )(转)

    1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’)    drop database [数据库名] ...

  10. 有两个指针pa,pb分别指向有两个数,a,b,请写一个函数交换两个指针的指向,也就是让pa指向b,让pb指向a

    题目:有两个指针pa,pb分别指向有两个数,a,b,请写一个函数交换两个指针的指向,也就是让pa指向b,让pb指向a,具体实现如下: #include<stdlib.h> #include ...