• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 3.1 Stateful and CDI Scope Conversation  RSS feed

 
Diego Gusava
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question, if I have an ejb .. @Stateful and @ConversationScope, the client (jsf) makes a request to my ejb, the ejb starts a conversation.begin() .... do something and show the response to the client ... the client makes a another request where now do something and close the conversation (conversation.end()) .... the ejb @Stateful is removed too? Or i have to explicit call @Remove ?
 
massimiliano cattaneo
Greenhorn
Posts: 24
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
If you want to remove the Stateful You have to call a Method annotated with @Remove.
But You can also annotate the Statefule with the @StatefulTimeout this means that after the unit value that You speified the container should remove the bean if the bean is idle.
Pay attention that the @PreDestroy Method is not called in this case (@StatefulTimeout).

Hope this help
 
Valery Lezhebokov
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
massimiliano cattaneo wrote:Hello,
Pay attention that the @PreDestroy Method is not called in this case (@StatefulTimeout).


In fact it's true only if the bean is in the Passivated state. If time out occurs in Method-Ready state, then the @PreDestroy method will be invoked.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!