wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes SLSB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "SLSB" Watch "SLSB" New topic
Author

SLSB

Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
A stateless session bean cannot access resource managers in a @PostConstruct method.
A stateless session bean cannot access resource managers in @PostCreate().
A stateless session bean cannot access resource managers in @Remove methods.

I agree with 3rd statement, but how can i agree with 1st and 2nd statement's.
There should be no implication accessing in these methods.


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9345
    
    2

Does the container recognize the @Remove callback for a Stateless session bean?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
thanks Jothi for your reply. That's why i have mentioned. I understand that 3rd statement is not possible. But why the first and second statement's are true.

Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Amandeep

From where you have this statements ?

About the PostConstruct -> it occurs after the dependency injection nad I think you have access to the resource manager.
About the PostCreate -> I am not shore if the PostCreate is a standard EJB annotation.


Regards
M


SCJP, SCJD, SCWCD, OCPJBCD
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
i do have these statement's from Enthuware explanation. If you need question, i can post for you.
Mihai Radulescu
Ranch Hand

Joined: Sep 18, 2003
Posts: 916

Hi Amandeep,


The question will help me to understand the better the problem, can you send it ?
Karnati Sudhakar
Ranch Hand

Joined: Aug 26, 2008
Posts: 270

A stateless session bean cannot access resource managers in a @PostConstruct method.
A stateless session bean cannot access resource managers in @PostCreate().
A stateless session bean cannot access resource managers in @Remove methods.


4.5.2 section of the specification document should clarify this question a little bit.

Regards
Sudhakar


Regards
Sudhakar
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Thanks Sudhakar- i should have hesitated to look in Specf.'s first.

Page 88 from core specf.-

PostConstruct, Pre-
Destroy lifecycle callback
interceptor
methods

can have access to these methods SessionContext methods: getBusinessObject,
getEJBHome, getEJBLocal-
Home, getEJBObject,
getEJBLocalObject,getTimerService,
lookup
JNDI access to java:comp/env
EntityManagerFactory access for CMT and SessionContext methods: getBusinessObject,
getEJBHome, getEJBLocal-
Home, getEJBObject,
getEJBLocalObject, getUserTransaction,
getTimerService, lookup
JNDI access to java:comp/env
EntityManagerFactory access for BMT.

If a session bean instance attempts to access a resource manager, an enterprise bean, an entity manager
or entity manager factory, and the access is not allowed, the behavior is undefined by the EJB
architecture.

I got it, for you other guys i will post the question by evening.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SLSB
 
Similar Threads
A stateless session bean cannot access resource managers in a @PostConstruct method.
Unspecified, but meaningful transaction?
doubt about ejbCreate()
Why ejbCreate and ejbRemove on a stateless bean cannot ...
(With wonderful replies) what decides access to Resource manager/Enterprise bean?