• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB3.1 - Environment Naming Context(ENC)

 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)




 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Pie
Posts: 2419
95
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. That doesn't work.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic