Forums Register Login

Stateless session beans

+Pie Number of slices to send: Send
Hi all,

What are the advantages of implementing the business logic in stateless session bean rather than implementing business logic with static methods in a java class.


Thanks,
Shyam
1
+Pie Number of slices to send: Send
With Stateless beans you will not worry about concurrency of dbConnections, objetcs. [=
1
+Pie Number of slices to send: Send
 

vShyam Sundar wrote:

What are the advantages of implementing the business logic in stateless session bean rather than implementing business logic with static methods in a java class.


You won't get any of the EJB semantics (like transactions) in a plain Java class. Furthermore, the stateless beans can have non-static fields (although the state shouldn't be relied upon between business method invocations), whereas your static methods on a plain Java class will not be able to store any object state.
+Pie Number of slices to send: Send
Thanks for all your replies. Now my understanding after much surfing for the question i posted goes like this.

When we use stateless session bean, When ever a client request comes in, the EJB container creates an instance of the bean i.e., EJB container pulls out an instance of the bean from a session pool. In this way we can achieve scalability and moreover performance tends to improve with EJB thread management,security and transactions. Whereas when you use your java classes, you always need to create an instance for the class which in turn depends on the heap memory.

Lets say for example an application with stateless session bean invoked by 1000 users at a particular time will have significant performance over same 1000 users accessing an application without stateless session bean.

And last but not the least, Maintenance of business logic which happens to change often(depends on the application) will be much easier with EJB because of loose coupling between the client and bean Whereas with a normal java class this tends to be more tedious.

Correct me if i my understanding was wrong. and also add to this thread if there are other benefits of using a stateless session beans over normal java classes.


this is supposed to be a surprise, but it smells like a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1357 times.
Similar Threads
business logic and ejb
best possible design pattern for a scalable enterprise application
Cade Class Diagram - Payment and ReturnRequest
what is the best way for session management in enterprise applications
Ejb and JMS Interaction
JNDI and DI
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 18:14:33.