• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful Bean injected inside Stateless bean

 
Sudhanshu Mishra
Ranch Hand
Posts: 238
1
Eclipse IDE Fedora Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What if I use JNDI lookups instead of injection of Stateful beans inside the Stateless Beans?
According to me this is still wrong and does not make a difference from injecting the bean, because for every Stateless bean pooled, there would still be that many Stateful beans , assuming each Stateless bean did a lookup and has got the reference.

Please correct my understanding.

Thanks,
Sudhanshu
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found an article online:

Keep in mind that you must not inject a stateful session bean into a stateless object, such as a stateless session bean or servlet that may be shared by multiple concurrent clients (you should use JNDI in such cases instead). However, injecting an instance of a stateless session bean into a stateful session bean is perfectly legal. Topic 12 discusses in much greater detail how you can use EJB from other tiers.

Reference: http://what-when-how.com/enterprise-javabeans-3/session-bean-clients-ejb-3/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic