• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Question on Bean state

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I encountered following question from one of the mock tests

Which of the following methods brings a bean from "does not exist" to pooled state?

A. ejbCreate
B. ejbLoad
C. setEntityContext
D. A call to any ejbHome<method>
E. A call to any ejbFind<method>

It was not mentioned what type of bean this was so I picked up A. but the answer given by the mock test tool was C. To my knowledge C could be true only for Entity beans. I don't understand how this could fit for all the beans. Any takers? Am I missing something here.

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

ejbCreate is not true for all beans, for entity beans, ejbCreate is called when a user calls for a finder/Create method, container takes one bean FROM the POOL, then calls its ejbCrate method to make it the OO view of the required entity. IT's not called when the bean is created.

ejbLoad is obviously not correct.

ejbHome is a container callback for home biz method invocation; takes an existing bean out FROM pool.

ejbFind is obviously wrong too.

The only one being called just before the bean starts existing and goes to pool is getEntityContext. This is only for entity beans, it's true, but the question does not specify it must apply to any kind of bean. And anyway it's the only possible answer.


I know what you think. "About ajbCreate, this silly guy told me it was not true for all beans, but now he says the question does not specify it must be for all beans".

You're right, I'm silly, but I'm right. The difference is that the question DOES say that the method MUST takes a bean from DNE state to POOLED state. For the ejbCreate, it's true for some cases, but there is some cases where ejbCreate does NOT do what we want here : entity beans. So you cannot say ejbCreate method takes a bean from DNE to P, because sometimes it does not.

In the other hand, the setEntityContext may be used only for EB, but the point is you CANNOT find a case where setEntityContext does NOT takes an EB from DNE to P state.

I hope I'm clear. This is a question understanding problem, which in some cases is quite tricky. The only solution is to read carefully the question and think about its meaning.

[ March 29, 2006: Message edited by: Frederic Esnault ]
[ March 29, 2006: Message edited by: Frederic Esnault ]
 
Sunil Dumpala
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frederic. Makes sense. You are right probably I will have to read more carefully. Well these are SUN exams, we shouldn't be surprised to see such tricky questions ;-) I have posted another question on Exceptions. Could you please check that out too ,if possible, I am sure that question also would have a similar explanation.

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

All the options relate to entity beans methods.(session beans have an ejbCreate() though).
So I think we should look at all the options and come to a conclusion that they are asking in terms of "Entity Beans".

Thakns
shanthisri
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic