This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Class level annotations in EJB3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Class level annotations in EJB3" Watch "Class level annotations in EJB3" New topic
Author

Class level annotations in EJB3

Vish Shukla
Ranch Hand

Joined: Oct 12, 2008
Posts: 111
Hi all,

I am new to EJBs. I am able to properly understand what exactly class level annotations for @Resource, @EJB & @PersistenceContext does and why these annotations exist. What I have understood yet is we need to use these annotations at Class/Type level when we want to manually lookup that resource/ejb.

It would be great if someone can elaborate this in detail. Thanks in advance.


Thanks & Regards,
Vishal S Shukla (SCJP 93%, SCWCD 94%, SCBCD 100%)
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9961
    
163

Does this help?


[My Blog] [JavaRanch Journal]
Vish Shukla
Ranch Hand

Joined: Oct 12, 2008
Posts: 111
What I am getting here is, using these, say @EJB, annotation at class level, we are creating one entry in the ENC of the containing bean & to map actual bean(instance) with this entry, we may directly link it by referring to another JNDI entry or by pointing to that EJB. Which can be done either by using "beanInterface" element in @EJB or by specifying <ejb-link> element in DD. Is this understanding correct?

One more thing I want to know is,
1. Is there any advantage of using this(class level) approach over DD?
2. What could be the consequences of using annotations at class level over using <ejb-ref>/<resource-ref> entries in the DD & vice-versa.

aze opuiy
Greenhorn

Joined: Dec 03, 2010
Posts: 4
Hello,

I didn't see this question, so i have posted a new one around the same subject :
http://www.coderanch.com/t/519214/EJB-JEE/java/Class-Type-level-resource-annotation

Sorry for that.

I don't understand the goal of the Class level annotations in EJB3 too.

Thank you for your help !
 
Don't get me started about those stupid light bulbs.
 
subject: Class level annotations in EJB3
 
Similar Threads
JNDI issue
web & application server
java:comp/env questions / doubts
The place where we define Annotations inside the EJB Bean class
difference between annotations