File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Callback methods in Session beans 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 "Callback methods in Session beans" Watch "Callback methods in Session beans" New topic
Author

Callback methods in Session beans

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

The below quote is from the specs,

PostConstruct callbacks occur after any dependency injection has been performed by the container
and before the first business method invocation on the bean.[/QUOTE

Now if I have an annotation in my session bean that calls another session bean, then do my PostConstruct callback occurs after the another session bean reference is resolved?


SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
If you are referring to EJB injection, yes, it's true.
But you cannot access those EJBs during PostConstruct method, because there is no transaction/security context.


SCJP<br />SCWCD 1.4 Upgrade (Remember: me stupid)<br />SCWCD 1.4<br /><a href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html" target="_blank" rel="nofollow">SCBCD 5.0</a><br /><a href="http://www.enthuware.com" target="_blank" rel="nofollow">SCBCD 5.0 mock exam</a> <br /> <br />SCEA 5 Part1: Preparing...
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9243
    
    1

Originally posted by Mirko Bonasorte:
If you are referring to EJB injection, yes, it's true.
But you cannot access those EJBs during PostConstruct method, because there is no transaction/security context.


I did not get your second line?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

I didn't get it either Enterprise bean access is allowed in PostContruct methods for stateful sessions beans.


[My Blog]
All roads lead to JavaRanch
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Sorry, this is true only for stateless.
Rahul Babbar
Ranch Hand

Joined: Jun 28, 2008
Posts: 210
Hi,

Any idea as to why is it only true for Stateless?

Rahul


Rahul Babbar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Callback methods in Session beans
 
Similar Threads
Stateful session bean doubt
Question regarding a session bean's life cycle ...
Doubt from the Specs
question about dependent injection
A stateless session question