• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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: 3411
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: 3411
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.
 
What is that? Is that a mongol hoarde? Can we fend them off with this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic