Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

ejbFind and bean state change

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
The EJB Specs (age: 169) state this
"The instance does not move to the ready state during the execution of a finder or a home method."
That means a bean remains in the pooled state even after ejbFind is called. In that case, how does the bean serve the business methods of the client ? Will ejbActivate get called for the first business method call, to move the bean to ready state ?
Thanks
Vipin
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vipin Mohan:
hi all
The EJB Specs (age: 169) state this
"The instance does not move to the ready state during the execution of a finder or a home method."
Will ejbActivate get called for the first business method call, to move the bean to ready state ?
Thanks
Vipin


You got it. The job of a finder is JUST to return a primary key (or a collection of primary keys... which then become EJB object references for the client) *without* going to the trouble of allocating a bean and populating its persistent fields with data from the persistent store (i.e. database).
The server doesn't want to waste anyone's time loading beans when the client *might* not ever use the references it "found".
But you're right, as soon as the client calls an actual business method on one of the component interfaces it got back, the server says, "Oh, I guess this client is SERIOUS, so NOW we have to move a bean out of the pool and call ejbActivate() and ejbLoad()...)"
Unless it's a Home business method, of course. In which case the bean still stays in the pool, since a Home business method is not invoked on any specific entity. Home business methods are the same as finders, in terms of not causing a state change in the bean.
cheers,
Kathy
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic