Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

some more HF final mock ques

 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
Consider this HF final mock exam questions.
1)
Q 32 / 646
Can MDB have overloaded ejbCreate methods?
Ans :: No , MDB have no clients.

Concern: I actully deployeed MDB with multiple ejbCreate(). So I think
you can have them , but no arg ejbCreate must be there.
( I used j2ee ri)

2)
Q 57
What's true about entity bean's identity?

Option: If 2 entity objects references are compaired using idIdentical,
the container will return T if 2 entity objects have same PK.

Ans:: T

Concern::
Please consider this scenario

UserHome uh= (UserHome)......
User u=uh.findByPrimaryKey("100");
// User entity uses String as Primary key class.
// already has entry with it.
AccountHome ah=(AccountHome).....
Account a=ah.findByPrimaryKey("100");
// Account entity also uses String as PK class
// Now...
String userPk=(String) u.getPrimaryKey();
String accPk(String)a.getPrimaryKey();

sop( userPk.equals(accPk) ); // should say Yeah

sop( u.isIdentical(a) ) ; // should say No...different Home

Now considering this cases, if isIdentical raises exception,
HF is right, but if it doesnt , wording or question should include
something about same/diff home.
What do you think?

3)
Q 65
In which cases session bean instance gets descarded without calling
ejbRemove();
c) An inactive client is timed out while bean in passive state.

Now, passivation doesnt apply to stateless, but since Q. is talkin about
session (by which ideally they would be wanting us to consider both types of beans and answer), do you think we should select this option?

Hey guys what do you say real exam too is somehow abstract in
wording of ques?

Your suggestions and corrections in my views are appreciated!!!

Amol.
 
Stefan Guilhen
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by amol deshpande:
Hi there,
Consider this HF final mock exam questions.
1)
Q 32 / 646
Can MDB have overloaded ejbCreate methods?
Ans :: No , MDB have no clients.

Concern: I actully deployeed MDB with multiple ejbCreate(). So I think
you can have them , but no arg ejbCreate must be there.
( I used j2ee ri)




The specification says (page 324) that the bean class must define the no arg ejbCreate() but it does not state that there must be only one ejbCreate method in the bean class. Based on that I would say that you can have overloaded ejbCreate methods in a MDB, but the container will only care about the no arg one.



2)
Q 57
What's true about entity bean's identity?

Option: If 2 entity objects references are compaired using idIdentical,
the container will return T if 2 entity objects have same PK.

Ans:: T

Concern::
Please consider this scenario

UserHome uh= (UserHome)......
User u=uh.findByPrimaryKey("100");
// User entity uses String as Primary key class.
// already has entry with it.
AccountHome ah=(AccountHome).....
Account a=ah.findByPrimaryKey("100");
// Account entity also uses String as PK class
// Now...
String userPk=(String) u.getPrimaryKey();
String accPk(String)a.getPrimaryKey();

sop( userPk.equals(accPk) ); // should say Yeah

sop( u.isIdentical(a) ) ; // should say No...different Home

Now considering this cases, if isIdentical raises exception,
HF is right, but if it doesnt , wording or question should include
something about same/diff home.
What do you think?



Interesting scenario, Amol.
Page 120 of the specification says "A client can test whether two entity object references refer to the same entity object by using the isIdentical method. Alternatively, if a client obtains two entity object references from the same home, it can determine if they refer to the same entity by comparing their primary keys using the equals method."

The isIdentical will simply return false if the two references compared did not come from the same home. I don't see why it should raise an exception. But, from the fragment above, we can see that the equals test on primary keys is only valid if the keys came from objects references from the same home. So you are right here, the questio should have said something about the home.



3)
Q 65
In which cases session bean instance gets descarded without calling
ejbRemove();
c) An inactive client is timed out while bean in passive state.

Now, passivation doesnt apply to stateless, but since Q. is talkin about
session (by which ideally they would be wanting us to consider both types of beans and answer), do you think we should select this option?

Hey guys what do you say real exam too is somehow abstract in
wording of ques?

Your suggestions and corrections in my views are appreciated!!!

Amol.


I would mark this option as correct, because it applies to stateful session beans, but one could really arg that this situation does not apply to stateless session beans and it would not be wrong either. Regarding the real exam, every question I got stated the type of the session bean when needed.

Regards,
Stefan
[ March 20, 2005: Message edited by: Stefan Guilhen ]
 
amol deshpande
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Stefan,
First of all thank you for taking time and answering my concerns.
For 2) above while solving the exam I just thought of some scenario like this one and because of obvious reasons I didnt select that option, but accoriding to HF I was wrong...but as you say Q. should have said about same home coz, even without same home, pk will say T but isIdentical will say F.
For 2) I've seen it doesnt raise Exception.
Great to know exam is pretty clear about options it wants us to consider.
Thank you once again.
Amol.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic