• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

stateless session beans v/s helper classes

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a stateful session ejb which is calling stateless session beans for some business processing.

Should I use helper classes instead of stateless session beans ..???
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The purpose of a stateless session bean is that you don't need to know where it gets executed. That is, you can have the business logic executed on a different server without your code caring about it, for example for scaling reasons.

OTOH, a stateless session bean also adds a huge amount of performance overhead and code complexity to the system.

I don't have a final answer, but I think I would go with POJOs (Plain Old Java Objects) as long as possible...
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since the stateful session bean already manages your transaction, you probably want to use POJO's behind it. On the other hand, you might want to use a stateless session bean before a bunch of entity beans to make a session facade. This way you keep your options open for possible clustering and distributing your project. You can make a facade with regular POJO's, but this will strap you to the same application server your stateful session bean is running. This is basically the same as Ilja Preuss said, but viewed from an other angle.

So depening on the appication lay-out, and the future expectations of your project, any of the two options is possible:

- One application server, no need to split up the application behind the statefull session bean, no need for remote access to the methods on the so called 'helper classes': definately POJO's

- Session facade wanted (this is a J2EE design pattern), remote access wanted, possibility to scale the application over multiple appliciation servers: stateless session bean will be the answer
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic