博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
What is therelationship between @EJB and ejb-ref/ejb-local-ref?
阅读量:5354 次
发布时间:2019-06-15

本文共 2677 字,大约阅读时间需要 8 分钟。

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



转载于:https://www.cnblogs.com/leeeee/p/7276693.html

你可能感兴趣的文章
Python之旅Day14 JQuery部分
查看>>
core--线程池
查看>>
redux-effect
查看>>
Android轻量级的开源缓存框架ASimpleCache
查看>>
他山之石:加载图片的一个小问题
查看>>
shell - 常识
查看>>
linux下编译复数类型引发的错误:expected unqualified-id before '(' token
查看>>
codeforces 1041A Heist
查看>>
Spring Cloud Stream消费失败后的处理策略(三):使用DLQ队列(RabbitMQ)
查看>>
bzoj1048 [HAOI2007]分割矩阵
查看>>
Java中的编码
查看>>
PKUWC2018 5/6
查看>>
As-If-Serial 理解
查看>>
洛谷P1005 矩阵取数游戏
查看>>
在Silverlight中使用HierarchicalDataTemplate为TreeView实现递归树状结构
查看>>
无线通信基础(一):无线网络演进
查看>>
关于python中带下划线的变量和函数 的意义
查看>>
linux清空日志文件内容 (转)
查看>>
Servlet接收JSP参数乱码问题解决办法
查看>>
Ajax : load()
查看>>