• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Queries on Entity Beans

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following questions regarding Entity beans:-

1. Why the ejbCreate() method in an entity bean always return null? Is this behaviour ejbCreate() method same for both CMP and BMP Entity beans?

2. If ejbActivate() and ejbPassivate() methods in an entity bean can get a reference of their EJBObject, then why these methods cannot access the security information about the client?

Thanks in advance!
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I only can help for the second question,
in ejb specification Page 436(21.2.5) and 451(21.6.5)
It is mentioned that container's responsibility is providing security context in business methods.

for the first question, I am also looking for it.
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somewhere between ejbActivate and ejbLoad the container associates the bean with a client. The same thing occurs after ejbStore() and before ejbPAssivate(). The entity bean is too general during activate and passivate to know about the client that is calling the business method. It has not been associated with a client or transaction.

I hope this helps.
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can explain you for the first question,

According to the specification the primary key for the entity must be set before ejbCreate completes, Once that is done the primary key is available through getPrimaryKey method of EntityContext. There should be some way to communicate to the container what primary will be used for this entity. In case of CMP we have to do something like setId() (id is the primary key and a virtual persistence field). So when ejbCreate returns the container knows the primary key and we return null, In case of BMP there is no way the container knows what the primary key is and hence we need to return the primary key class and not null from the ejbCreate of BMP bean.
 
Saurabh Chaubey
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Amol for the explanation!!!
 
I am mighty! And this is a mighty small ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic