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

getPrimarykey() call in ejbActivate()/ejbPassivate()?

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

It is possible to call getPrimaryKey() in ejbActivate()/ejbPassivate() methods of entity bean. But in these method the bean is still NOT associated to any entity. So, how does it possible?

Thanks,
Prashant
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

One of the ways a bean transitions from "Pooled State" to "Method Ready State"
is through ejbActivate() and you have access to getPrimaryKey() method but you can not use the setters and getters until the ejbLoad() method callback.

Here is what happens

1. Client calls a business method.
2. The container sees that it, does not have the bean instance for that entity in "Method Ready State"
3. It takes an instance from the pool.
4. Assigns the EJBObject(Context) to bean instance.
5. calls ejbActivate() , now you can acess the primaryKey of the Object instance.
6. Container loads the data from the database and sets the instance fields of the bean.
6. calls ejbLoad().

Vijay.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prashant,

When ejbPassivate calling on Entity Bean instance mean, Still entity bean in method ready state, but ready to move method ready state to Pooled state and not interested in business method processing.

After ejbPassivate only, it goes to pooled state.

Regards
Kasimurugan R.
 
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic