Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Callback methods in Session beans

 
Joe Harry
Ranch Hand
Posts: 10077
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Joe Harry
Ranch Hand
Posts: 10077
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't get it either Enterprise bean access is allowed in PostContruct methods for stateful sessions beans.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, this is true only for stateless.
 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Rahul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic