GeeCON Prague 2014*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes EJB3.1 - Environment Naming Context(ENC) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "EJB3.1 - Environment Naming Context(ENC)" Watch "EJB3.1 - Environment Naming Context(ENC)" New topic
Author

EJB3.1 - Environment Naming Context(ENC)

Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi,
I'm going through this Enterprise Java Beans 3.pdf (by Frits). I have found few things which might need changing. Not sure, if these are already notified.

Page 6-61

Other Callback methods (@prePassivate, @PostActivate,...), there is no need to mention "(not Singleton)" as these methods are not applicable to Singleton beans.


Page 7-63

The title should have been "7 Injection and Environment Naming Context(ENC)"


Page 7-74
There is a note at the bottom saying-
Note: an entry is only created when both “name” and “lookup” are specified in the @Resource annotation.


I think an entry is also created when there is neither "name" nor "lookup".
java:comp/env/<package-name>.<bean name>/<field name> (for @Resource with no attributes)





Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Naren Chivukula wrote:
Page 6-61
Other Callback methods (@prePassivate, @PostActivate,...), there is no need to mention "(not Singleton)" as these methods are not applicable to Singleton beans.

Agree, fixed.

Naren Chivukula wrote:
Page 7-63
The title should have been "7 Injection and Environment Naming Context(ENC)"

Both names (Environment Naming Context, Enterprise Naming Context) are used in the java world, but I agree I should use the name from the specs: Environment Naming Context. Fixed.

Naren Chivukula wrote:
Page 7-74
There is a note at the bottom saying-
Note: an entry is only created when both "name" and "lookup" are specified in the @Resource annotation.

I think an entry is also created when there is neither "name" nor "lookup".
java:comp/env/<package-name>.<bean name>/<field name> (for @Resource with no attributes)

There is no entry created in this case, and an explicit lookup in this case will fail with a javax.naming.NameNotFoundException.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

You are right. But, I was asking in a case where no attribute is provided for @Resource, then also a new entry is created?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1686
    
  25

Do you mean like this (for "init")?

In this case there is no entry created and the lookup in line 6 will fail.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Yes, you are right. That doesn't work.

Thanks.
 
GeeCON Prague 2014
 
subject: EJB3.1 - Environment Naming Context(ENC)