This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 9345
    
    2

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, Certified Scrum Master
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: 9345
    
    2

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
A stateless session question
Stateful session bean doubt
Question regarding a session bean's life cycle ...
Doubt from the Specs
question about dependent injection