Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 Statefull & Stateless Cant see the Difference  RSS feed

 
Dhiren Lodhia
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I know EJB 2.0 as well as EJB 3.0,Hence i know that tat in 2.0 in Stateful EJB we were used to pass the param to create() & ejbCreate() which is how we were used to get the same Bean instance from Bean Pool or in other words we could maintain the state of user & hence make EJB really statefull!!
We could have seen the piratically in 2.0 !!!

Now in EJB3.0 we first of all do not Pass the parameters to Statefull EJB method its Just @Stateful annotation tats it!!!
I m just not able to understand how J2EE server will give the same instance of ejb from EJB pool to that user & even if it will happen how can i store user's state specific data in tat EJB.

I have tried simples examples to see the difference practically but i cant get the out put as required!!

can any one help??
if possible please give the simplest example of two EJBs one stateful and one stateless (3.0) in which we can see the out put practically when we run them !!!

I m using NetBeans 6.1 & glassfish V2 .

Thanks in advance!!!
(Please give code example)
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dhiren,
This should still be happening behind the scenes. Are you saying you stored a unique value in the bean and got a different one when you were using stateless beans?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!