• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Why ejbCreate and ejbRemove on a stateless bean cannot ...

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I am confused with this rule. The chapter about stateless session bean says ejbCreate() and ejbRemove cannot access antoher bean's methods and resource manager.
Why a stateful session bean can, but a stateless session bean cannot?
Thanks~
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To have this access you have to be in a transactional context OR have a client security context.
In ejbCreate and ejbRemove in a session bean you do not have a transactional context.
In a stateful session bean you do have a client security context in ejbCreate and ejbRemove as opposed to in a stateless session bean.
That gives you access in a stateful session bean, but not in a stateless.

/Hope it helps
Magnus
[ January 29, 2004: Message edited by: Magnus Stattin ]
 
Kuo-Feng Sun
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Magnus,
I got it. Thanks very much!!
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

To have this access you have to be in a transactional context OR have a client security context.



I can not find any description about this concept in the ejb specification. in my mind, the resource manager is the sth like connection factory, then it seems no reason to disallowed the method to use it and if it can not be used it in staeless bean, then how can it access the database?

Sorry, I am new to EJB, please rectify me.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

In specs, there are tables showing which operations are in each type of ejb and below the table reasons why a particular method is disallowed.

stateless bean age 90,91
statefull bean age 80,81
entity bean: page 179,180
message driven bean: page 320,321

bhilla
 
Paper beats rock. Scissors beats tiny ad.
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic