|
Nice collection with answers it is great site itcertkeys.com u must visit this site thanks
|
Question 1. Which is a valid Post Construct method in a message-driven bean class? A. @Post Construct public boolean init() { return true; } B. @Post Construct private static void init() {} C. @Post Construct private void init() {} D. @Post Construct public static void init() {} Answer: C Question 2. Given: 11. Entity public class X { 12. @ld int id; 13. Y y, 14.} A public class Y with NO Java Persistence annotations is defined in the same package. Which statement is correct about these classes if NO other annotations and mapping descriptors are provided? A. Class Y must be serializable. B. Class Y must be marked as an entity. C. The entity X is not defined correctly. The field y must be marked as @Lob. D. Class Y must be accessed by a persistence application through a public interface. Answer: A Question 3. A developer is working on a user registration application using EJB 3.0. A business method register User in stateless session bean RegistrationBean performs the user registration. The register User method executes in a transaction context started by the client. If some invalid user data causes the registration to fail, the client invokes register user again with corrected data using the same transaction. Which design can meet this requirement? A. Have register User method call EJBContext.setRollbackOnly() method after registration fails. B. Have register User method throw javax.ejb.EJBTransactionRequiredException after registration fails. C. Have register User method throw EJBException without marking the transaction for rollback, after registration fails. D. Create an application exception with the rollback attribute set to false and have register User method throw it after registration fails. Answer: D Question 4. Which two class types must be implicitly or explicitly denoted in the persistence.xml descriptor as managed persistence classes to be included within a persistence unit? (Choose two.) A. Entity classes B. Interceptor classes C. Embedded classes D. Entity listener classes Answer: A, C Question 5. Which statement about the combination of mapping defaults, annotations, and XML descriptors is correct? A. All mapping annotations must always be processed by the persistence provider. B. Some annotations, like the @Entity annotation, must always be processed by the persistence provider. C. The mapping information for an entity class specified by annotations and in XML descriptors must be distinct. D. If multiple entity listeners are defined, the order in which they are invoked can be defined or overwritten in the XML descriptor. Answer: D Question 6. Which statement about an entity instance lifecycle is correct? A. A new entity instance is an instance with a fully populated state. B. A detached entity instance is an instance with no persistent identity. C. A removed entity instance is NOT associated with a persistence context. D. A managed entity instance is the instance associated with a persistence context. Answer: D Question 7. A developer implements a session bean with a method doStuff which behaves differently depending on the caller's security role. Only users in security roles "ADMIN" and "USER" are allowed to call the method. Assume that there is no security-related metadata in the deployment descriptor. Which two, taken in combination, are appropriate to accomplish this? (Choose two.) A. Annotate method doStuff with @PermitAll. B. Annotate method doStuff with @RolesAllowed({"ADMIN","USER"}) C. lf EjBContext.getCallerPrincipal returns role "ADMIN", implement the behavior for users in role ADMIN. D. If EJBContext.isCallerlnRole("ADMIN") returns true, implement the behavior defined for users in role "ADMIN". Answer: B, D Question 8. A developer wants to create a portable EJB 3.0 application that includes the following class definition for the Entity Account 11. @Entity 12. @EntityListeners(com.acme.AlertMonitor.class) 13. public class Account { 14. // more code here 15. @PrePersist 16. protected void validatecreate() {/* more code here */} 17.} Which statement is correct? A. The validateCreate method may NOT throw runtime exceptions. B. The validateCreate method can invoke the EntityManager.flush operation. C. Methods of the class com.acme.AlertMonitor annotated with callback annotations must take an Object or Account instance as the only argument. D. The above class definition is NOT correct. An entity cannot define a callback method like PrePersist and use the EntityListeners annotation at the same time. Answer: C Question 9. Given: 11. @PersistenceContext EntityManager em; 12. public boolean test(Order o){ 13. boolean b = false; 14. o = em.merge(o); 15 em.remove(o); 16. o = em.merge(o); 17. b = em.contains(o); 18. return b; 19. } Which statement is correct? A. The method will return TRUE. B. The method will return FALSE. C. The method will throw an exception. D. The Order instance will be removed from the database. Answer: C Question 10. The deployment descriptor for a stateless session bean that uses the isCallerlnRole method reads as follows: 3.4. manager 5.humanresources 6.16. 17. Which two roles are responsible for creating this deployment descriptor? (Choose two.) A. Deployer B. Bean Provider C. System Administrator D. Application Assembler Answer: B, D18. Is allowed to view and update all employee records. 19. 20.humanresources 21.
Copyright © 2004 CertsBraindumps.com Inc. All rights reserved.