This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

EJB3.1 - Environment Naming Context(ENC)

 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)




 
Creator of Enthuware JWS+ V6
Posts: 3409
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3409
320
Android Eclipse IDE Chrome
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right. That doesn't work.

Thanks.
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic