This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how many PrePassivate methods we can have in an stateful session bean ?

 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how many PrePassivate methods we can have in an stateful session bean ?
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
same number as SB (SLSB) can have postActivate.
I have not tried more than one in single SB.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
only one.
 
Marcos Serrano
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only one...plus several lifecycle callback methods can be used in one single method.

@PrePassivate
@PreRemove
public void cleanUp()
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you decide to define lifecycle events interceptors in different classes (not directly in the bean), the spec says :
Lifecycle callback interceptor methods may be defined on superclasses of the bean class or interceptor classes. However, a given class may not have more than one lifecycle callback interceptor method for the same lifecycle event. Any subset or combination of lifecycle callback annotations may be specified on a given class.


Anyway, what would be the use of defining several PrePassivate methods ?
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
lets keep it simple. How many method(s) I can annot with @PrePassivate in a statefull session bean ? Many places I have seen the answer is "ONE".
I have tested this in JBoss 5, JBoss did PERMIT me to have two methods with @PrePassivate annotation. It did not throw any spec vilocation error/exception ? Does the JBoss not follow the spec ? or we can have more than one @PrePassivate method inside the bean. (Not talking about interceptors at all).
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My answer is "one". And don't trust what JBoss allows you to do, it's not a reference implementation. (even so-called reference implementation are sometimes doubtful).
 
Sanju Thomas
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic