Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

stateless session beans v/s helper classes

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
    Bookmark Topic Watch Topic
  • New Topic