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

Mock Question - I'm I missing something?

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would someone have a look at this mock question and tell me if I'm missing something? I think 'D' is right.
--Dale--
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right! Answer "E" is stupid answer.
[ May 09, 2004: Message edited by: Alibabra Sanjie ]
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's mock question that I'm having trouble with.
The question is about what exception is thrown if a remote client attempts to access an entity bean that's been removed. One would think they were looking for the exception that the client would get, not one that's internal to the container.
--Dale--
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's another one that I think is 'bad'. Would folks agree that we would need an "implements Serializable" on there?
--Dale--
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The question is about what exception is thrown if a remote client attempts to access an entity bean that's been removed. One would think they were looking for the exception that the client would get, not one that's internal to the container.


I agree with the answer as it is correct according to the spec.
Contrast this with two other possible questions.
1. What exception must be thrown to a remote client which tries to remove an entity bean. (Answer: java.rmi.RemoteException)
2. What exception should be thrown to a remote client which tries to remove an entity bean. (Answer: java.rmi.NoSuchObjectException)
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Would folks agree that we would need an "implements Serializable" on there?


Yup, as the primary key class must be Serializable and public.
These mocks don't appear to be of the best quality
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are two questions from the same test that seem to contradict each other: example 1, example 2.
With so many of these incorrect and muddy questions, I seem to be loosing a lot of time from my studies. Also, I'm concerned that I may "learn" incorrect material from the questions that are just plain wrong! I think I better find a different way to study for this test!
--Dale--
 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In both examples 1 and 2 Option E is correct.
As EnitiyContext interface doesn't define "getEJBLocalObject()" or "getEJBObject()" methods.
James
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Dale Seng:
Here's another one that I think is 'bad'. Would folks agree that we would need an "implements Serializable" on there?
--Dale--


The class must also have a valid override of equals() and hashcode() and public accessor methods for the cm-fields
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Here are two questions from the same test that seem to contradict each other: example 1, example 2.


The two mocks are correct. javax.ejb.EJBContext is the superinterface which declares these methods:
public EJBHome getEJBHome()
public EJBLocalHome getEJBLocalHome()
public java.security.Principal getCallerPrincipal()
public boolean isCallerInRole(java.lang.String roleName)
public UserTransaction getUserTransaction()
public void setRollbackOnly()
public boolean getRollbackOnly()

EJBContext is extended by three interfaces: javax.ejb.MessageDrivenContext (which adds no methods) and by javax.ejb.SessionContext and javax.ejb.EntityContext. The latter two both add these methods:
public EJBLocalObject getEJBLocalObject()
public EJBObject getEJBObject()

Furthermore, EntityContext adds this method:
public java.lang.Object getPrimaryKey()

This is why example 1 and example 2 are correct.
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I get it! Since there is no method in the EJBContext, that's why that one is "none of the above". I don't know why I didn't see that. Thanks.

--Dale--
    Bookmark Topic Watch Topic
  • New Topic