permaculture playing cards*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Can't we have more than 1 @Resource annotation specified on bean class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Can Watch "Can New topic
Author

Can't we have more than 1 @Resource annotation specified on bean class ?

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

i specified 2 @Resource annotations on a bean class. the name attribute of both the resource were different but still eclipse gave an error that duplicate Resource annotation exists.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1700
    
  25

Hi,

Yes you can have more resources of a class. Just like defining more @EJB's on a class is done with @EJBs, multiple resource can be declared bij using @Resources, for example (from: Oracle EE5 tutorial):

Regards,
Frits
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

Thanks a tonne Frits
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can't we have more than 1 @Resource annotation specified on bean class ?