Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Stateful bean marked as @WebService ?  RSS feed

 
Ramy Nady
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

I always use stateless session bean for my business logic and I can then expose it as web service , using @stateless and @WebService.

Is it available to do the same using statefuel session bean instead ?
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to? A stateful bean is meant to contain conversational state. A stateless bean can also contain state, it just shouldn't be exposed. Something like an HttpClient should be no problem. And if you need state that can't be disposed of, use a singleton bean instead. Just make sure to correctly configure concurrency, otherwise it can be a huge bottleneck.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!