This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
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.
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.