This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
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

life cycle and access to beanness

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to make my mind completely clear of all the confusion i had about 'life cycle and access to beanness' and stuck at start with stateless beans
if the create() from client is triggering EJBObject creation how can we have access to getEJBObject() in ejbCreate() which is part of creating the the bean and putting it in the pool
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Girija,
If you take a close look at the interaction diagram in page 227 of HFEJB, you'll see that call to create() method in home object and the correspoing call to ejbCreate() in the bean occurs at a completely different time. You will also find that ejbCreate() method is called when EJBObject is already made available by the container.

Hope the diagram clears your confusion.

Suman
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will also find that ejbCreate() method is called when EJBObject is already made available by the container.


The timeline of create() on home and ejbCreate() on bean are unrelated is it not.
Per say, the container creates beans and puts them in pool. It calls ejbCreate() as part of the bean creation. At that time there is no client create call on the home.
EJBObject is created as part of the client create() call at a different time.
When is it the EJBObject is associated with the bean???
When ejbCreate() is called there is no client=> no call create() on home=> no creation of EJBObject , how is it EJBObject is available at the time of calling ejbCreate(). What is it I am missing in here
Thanks in advance
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For any type of session bean, the EJBObject is available before ejbCreate(). Why? Because the EJB spec writers made it mandatory! The idea is that the bean provider may need to acquire a reference to the EJBObject from ejbCreate(). So, it's up to the EJB Container provider to somehow implement this.

Note that for entity beans, the EJBObject is not available in ejbCreate() as the PK is not available, but you can get it in the next method call - which is ejbPostCreate().
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roger Can you plaese refer to the page of the spec that makes this mandetory
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is implied, because getEJBObject and getEJBLocalObject are available from within ejbCreate().
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Girija,
Did you understand the answers provided. I did not. Unaware of this posting, I started another discussion here. I have not got any convincing answer yet. Since you had the same question may be if you have an answer, you can explain that to me.

thanks.
Kaarthik
 
Kaarthik Sivashanmugam
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer to the discussion: https://coderanch.com/t/159389/java-EJB-SCBCD/certification/calling-getEJBObject-ejbCreate-Stateless-session

It has pointers to the explanation for this behaviour.
 
Run away! Run away! Here, take this tiny ad with you:
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