This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

@EJBs annotation.  RSS feed

 
Udara Amarasinghe
Ranch Hand
Posts: 109
Java Netbeans IDE Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do someone knows, how to use @EJBs annotation?
 
Jayr Motta
Ranch Hand
Posts: 110
Google App Engine Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Udara,

You must've realized that this annotation takes in its attribute value an array of @EJB, this is used to annotate a bean that somehow refers these @EJB. In other words, doing this the EJB's will be available in the JNDI ENC of the actual EJB, the you'll be able to lookup them through the EJBContext.lookup(...) using a relative path.

I can't also really understand the reason to it, once you could annotate a given interface inside the bean and already inject the desired EJB. Besides the possibility to lookup the bean programmatically (that's also possible after inject directly, but in this case you've already injected one instance of the given EJB), I don't see any good reason to create a reference in the JNDI ENC through annotations to lookup it using InitialContext, EJBContext, etc .. I thought the desired behavior was the opposite.

Maybe there are some obscure reason that we're not seeing that justify the use of it, if you discover, let me know please!

 
Udara Amarasinghe
Ranch Hand
Posts: 109
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jayr for your comment.
And
Jayr Motta wrote:Maybe there are some obscure reason that we're not seeing that justify the use of it, if you discover, let me know please!

I will definitely inform you, if I discover.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!