Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejb-ref and ejb-local-ref can be used for message driven beans?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think <ejb-ref> and <ejb-local-ref> are only used for session and entitiy beans, can we use them for message driven beans too?
 
Vaithiya Sundaram
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by yamini nadella:
I think <ejb-ref> and <ejb-local-ref> are only used for session and entitiy beans, can we use them for message driven beans too?


You can use them for MDB too. i.e. MDB intern can have reference with other beans.
 
Karin Paola Illuminate
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a question about ejb-ref and ejb-local-ref... An enterprise bean can refer to the homes of other enterprise beans using "logical" names called EJB references. References to other beans can be local or remote. But, message driven beans have no unique identity to clients � they don�t have clients (NO home interface, NO component interface, and no local vs. remote).

So, my question is : Is it possible to define a <ejb-ref> or a <ejb-local-ref> elment for message-driven beans??? I mean is it possible to define this in the DD WITHOUT a <home> and <remote> element for <ejb-ref> or a <local-home> and <local> for <ejb-local-ref>???

I also thought that the <ejb-ref-type> element should NOT be a message-driven bean (and that the <res-ref-type> could only be either �Session� or �Entity�).

Please, help me out. I'm confused... Confused

(I also posted this question on jdiscuss.)
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There seems to be a confusion here. Let me clarify this with this example of DD:

<message-driven>
............................
<ejb-name>MyMDBBean</ejb-name>
............................
<ejb-ref>
<ejb-ref-name>ejb/MySessionBean</ejb-ref-name>
<home>com.xyz.MySessionBeanRemoteHome</home>
<remote>com.xyz.MySessionBeanRemote</remote>
..........................................
</ejb-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/MyEntityBean</ejb-ref-name>
<local-home>com.xyz.MyEntityBeanLocalHome</local-home>
<local>com.xyz.MyEntityBeanLocal</local>
..........................................
</ejb-local-ref>
</message-driven>

Here MyMDBBean has remote reference(ejb-ref) to MySessionBean and local reference (ejb-local-ref) to MyEntityBean.

Hope this clears the confusion.

Thanks

-- Ravi
[ March 28, 2005: Message edited by: Ravindra Janapareddy ]
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karin,

If I understand your question correctly, according to my understanding-
It is possible to have (MDBs) refering Entity or Session beans. (as Ravindra explained.)
But no type of EJB can refer to MDB in ejb-ref.


<ejb-ref>
<description>ejb Reference description</description>
<ejb-ref-name>ejb/otherRemoteEntityName</ejb-ref-name>
<ejb-ref-type>Entity OR Session</ejb-ref-type>
<home>otherEntityBeanRemoteHome</home>
<remote>otherEntityBeanRemote</remote>
<ejb-link>SomeEntityOrSessionBeanName</ejb-link>
</ejb-ref>

Note --
<ejb-ref-type>Entity OR Session</ejb-ref-type>


Thanks,
Gemini
[ March 28, 2005: Message edited by: Gemini Moses ]
 
X. Li
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was ever confused by <ejb-ref> and <ejb-local-ref> before. Actually, <ejb-ref> and <ejb-local-ref> mean that you want to use other bean <ejb-ref> inside a bean and you have to specify it in DD. For example, in a Message Driven bean, you want to use a Session Bean (MySessionBeanRemoteHome), then you must define this session bean as <ejb-ref> or <eib-local-ref>, just like above DD written by Ravindra Janapareddy.

Hope this help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic