JavaBeat
calling cards | international calling cards | phone card
Search JavaBeat

SCBCD TOPICS

scbcd Home

objectives

mock exams

scbcd mock - 1

scbcd mock - 2

scbcd mock - 3

scbcd mock - 4

scbcd mock - 5

scbcd mock - 6

scbcd mock - 7

scbcd mock - 8

scbcd mock - 9

scbcd mock - 10

scbcd mock - 11

scbcd mock - 12

scbcd mock - 13

scbcd mock - 14

JAVABEAT
home
articles
tips
code junction
forums
OUR NETWORK
javabeat

SCBCD Mock Questions - 10 - Answers

1)1,2 Answers 1 and 2 are correct. After the container has created the entity bean, with newInstance() and the entityContext has been set the instance becomes part of the pool. While the instance is in the pooled state, the container may use the instance to execute any of the entity bean's finder methods or any of the entity bean's home methods.
The instance does not move to the ready state during the execution of a finder or a home method. An ejbSelect() method may be called by an entity bean's home method while the instance is in the pooled state.
Answer 3 is incorrect, executing the ejbCreate method will move the entity bean from the pooled to the ready state.
Answer 4 is incorrect, executing the ejbActivate method will move the entity bean from the pooled to the ready state and the ejbPassivate method moves the entity bean from the ready state to the pooled state.
Answer 5 is incorrect, business methods will be executed on entity bean's that are in the ready state.

2)1,2,3
Answers 1, 2 and 3 are correct.
At the moment the container passivate the bean is no longer associated with a particular client or transaction. The container invokes this method on an entity bean instance at passivation time (i.e. when the instance is being disassociated from an entity object identity and moved into the pool). The container must ensure that the identity of the associated entity object is still available to the instance if the instance invokes the getPrimaryKey(), getEJBLocalObject(), or getEJBObject() method on its entity context.
The container invokes this method with an unspecified transaction context.

3)1,4
Answers 1 and 4 are correct.
Answer 2 is incorrect, there are zero or more ejbCreate() methods, whose signatures match the signatures of the create() methods of the entity bean's home interface.
Answer 3 is incorrect, the bean provider of an entity bean with container-managed persistence does not write the finder methods. The finder methods are generated at the entity bean deployment time using the Container Provider's tools.
Answer 5 is incorrect, the Bean Provider may provide zero or more select methods. A select method is a query method that is not directly exposed to the client in the home or component interface. The bean provider typically calls a select method within a business method. The bean provider defines the select methods as abstract methods.

4)1,2,4
Answers 1, 2 and 4 are correct. The following methods can be used from within the ejbCreate() method:
* getEJBLocalHome
* getEJBHome
* getCallerPrincipal
* getRollbackOnly
* isCallerInRole
* setRollbackOnly
Within the ejbCreate() method you can access the JNDI environment and you have access to the resource manager.
CMP entity bean instances must not call the getUserTransaction(). If the entity bean tries to access methods that are not allowed then the container will throw IllegalStateException.

5)2,3,5
Answer 1 is incorrect, the container may delete the representation of the entity in the database immediately, or it can defer it to a later time, depending on the caching strategy that it uses.
Answer 2 is correct, the persistent state of the instance at the beginning of the ejbRemove() method is the same as it would be at the beginning of a business method. The container must invoke ejbLoad before it invokes ejbRemove().
Answer 3 is correct, the container invokes the ejbFind() method on an instance when a client invokes a matching find() method on the entity bean's home interface.
Answer 4 is incorrect, the ejbHome() method is executed on an entity bean in the pooled state.
Answer 5 is correct.

6)1,2,5
Answers 1, 2 and 5 are correct.
The following are the requirements for a CMP entity bean class:
* The class must implement, directly or indirectly, the javax.ejb.EntityBean interface.
* The class must be defined as public and must be abstract.
* The class must define a public constructor that takes no arguments.
* The class must not define the finalize() method.
* The entity bean class must implement the business methods, and the ejbCreate() and ejbPostCreate() methods.
* The entity bean class must implement the ejbHome() methods that correspond to the home business methods specified in the bean's home interface.
* The entity bean class must implement the get and set accessor methods of the bean's abstract persistence schema as abstract methods.
* The entity bean class does not implement the finder methods. The implementations of the finder methods are provided by the container.
* The entity bean class must implement any ejbSelect() methods as abstract methods.

7)1,3
Answers 1 and 3 are correct.
An entity bean instance's life starts when the container creates the instance using newInstance(). The container then invokes the setEntityContext() method to pass the instance a reference to the EntityContext interface. The EntityContext interface allows the instance to invoke services provided by the container and to obtain the information about the caller of a client-invoked method.
At this moment the only valid operations within the setEntityContext() method are:
1. getting a reference to your home with getEJBHome() or getEJBLocalHome().
2. having access to your JNDI environment.
It is not possible to get a reference to your EJBObject or to get security information about the client at this moment. If the entity bean tries to access methods that are not allowed then the container will throw an IllegalStateException.1,2,5

8)2,3
Answers 2 and 3 are correct.
An instance transitions from the pooled state to the ready state when the container selects that instance to service a client call to an entity object. There are two possible transitions from the pooled to the ready state: through the ejbCreate() and ejbPostCreate() methods, or through the ejbActivate() method.
The ejbActivate() invokes this method on the instance when the container picks the instance from the pool and assigns it to a specific entity object identity.

9)1,4
Answers 1 and 4 are correct.
The following rules need to be followed to declare a correct ejbCreate() method:
* The method name must have ejbCreate as its prefix.
* The method must be declared as public.
* The method must not be declared as final or static.
* The return type must be the entity bean's primary key type.
* The return type must be serializable.

10)ejbPassivate is correct.
The container can choose to passivate an entity bean instance within a transaction. To passivate an instance, the container first invokes the ejbStore method to allow the instance to prepare itself for the synchronization of the database state with the instance's state, and then the container invokes the ejbPassivate method to return the instance to the pooled state.


Favorites
AffiliatedAds.com
Buy movies
Access Control
Busby seo challenge contest
Sohbet
Chat
Webmaster Hosting Forum
Java Jobs
MyVideoLib
India News
Internet Advances
Sohbet
chat
Latest QnA
SCJD Tips
When we start a thread by applying start() method on it ,how does it knows that to execute run()method?
About Wrapper class in Java
How to configure weblogic 7.0 in MyEclipse?
Static Block and Static Initializer in Java

JavaBeat Website (2004-2008), India
javabeat | about us | planetoss
Copyright (2004 - 2008), JavaBeat