Given a set of CMT bean methods with the following transaction attributes: Method M1=SUPPORTS Method M2=REQUIRED Method M3=NOT_SUPPORTED Method M4=REQUIRES_NEW And the following method invocation sequence: Method M1 invokes Method M2 Method M2 invokes Method M3 Method M1 invokes Method M4 If Method M1 is invoked by a method that does NOT have a transaction context, which describes a possible scenario?
A. Method M1notransaction MethodM2new transaction Method M3no transaction MethodM4newtransaction
B. Method M1notransaction Method M2Container throws EJBTransactionRequiredException
C. MethodM1new transaction Method M2runs in same transaction as M1 Method M3Container throws TransactionNotSupportedException
D. Method M1no transaction Method M2new transaction Method M3Container throws TransactionNotSupportedException
A session bean calls the setRollbackOnly method on the EJBContext interface within a business method with an active transaction. Which two are correct? (Choose two.)
A. The transaction timeout is immediately disabled.
B. The container will ensure that the transaction will never commit.
C. The bean must have started the current transaction for this to be legal.
D. The bean must have bean-managed transaction demarcation for this to be legal.
E. Thebean must have container-managed transaction demarcation for this to be legal.
A developer writes an enterprise application and packages it into an enterprise archive (EAR). The application contains one persistence unit with unit name "FooPU". The application also contains an ejb-jar with one stateless session bean. Which code, when added to the stateless session bean class, injects a container-managed persistence context at runtime?
A. @PersistenceContext EntityManager em;
B. @Resource(unitName="FooPU") EntityManager em;
C. @PersistenceUnit(unitName="FooPU") EntityManager em;
D. @PersistenceContext(unitName="persistence/FooPU") EntityManager em;
A Java EE 5 application contains a session bean which uses a security role USER. A group called people is defined in an LDAP server. Which two define appropriate EJB role responsibilities? (Choose two.)
A. The deployer definesandconfigures the LDAP realm.
B. The system administratordefines and configuresthe LDAPrealm.
C. Thedeployermaps the application role USER totheLDAP group people.
D. Thesystem administrator maps the application role USER totheLDAP group people.
Which statement is true about both stateful session beans and stateless session beans?
A. Bean instances are NOT required to survive container crashes.
B. Any bean instance must be able to handle concurrent invocations from different threads.
C. A bean with bean-managed transactions must commit or roll back any transaction before returning from a business method.
D. The container passivates and activates them using methods annotated with @PrePassivate and @PostActivate annotations.
Which statement is correct about a Java EE client of a message-driven bean?
A. Theclientcan useJNDI toobtainareference to a message destination.
B. The clientcan use JNDItoobtain a reference toadependency injection.
C. The client canuseJNDI to obtain a reference to a message-driven bean instance.
D. Theclient can use JNDI to look upareference tothemessage-driven bean's home interface.
A developer creates a statelesssession bean, EmployeeServiceBean, and itsinterface, EmployeeSeivice. The session bean uses two annotated entity classes, Employee.class and Department.class. Which two packaging options can the developer use when creating a deployable EAR? The proposed directory structure is listed for each option. (Choose two.)
A. emp.ear emp-ejb.jar META-INF/persistence.xml EmployeeSeivice.class EmployeeServiceBean. class lib/emp-classes.jar Employee.class Department.class
B. emp.ear META-INF/orm.xml emp-ejb.jar EmployeeSeivice. class EmployeeServiceBean. class Employee.classDepartment.class
C. emp.ear emp-ejb.jar META-INF/persistence. xml Employee.classDepartment.class EmployeeSeivice. class EmployeeServiceBean.class
D. emp.ear emp-ejb.jar persistence.xml Employee.class Department.class EmployeeSeivice. class EmployeeServiceBean.Class
Which statement is correct about the Java Persistence API support for the SQL queries?
A. SQL queries are NOT allowed to use parameters.
B. The result of an SQL query is not limited to entities.
C. Only SELECT SQL queries are required to be supported.
D. SQL queries are expected to be portable across databases.
A Java Persistence application uses entities mapped to tables from two datasources in the same transaction. What statement is correct?
A. This is NOT possible.
B. The entities mustbepackaged into two persistence units.
C. The entitiescanbe packaged intoa singlepersistence unit
D. Theentities must be packaged usingtwo differentpersistence.xml files.
Which two options can be used to predefine Java Persistence queries for easy use? (Choose two.)
A. @NamedQuery annotation
B. @NamedNativeQuery annotation
C. using the named-query element in the XML descriptor
D. usingthenamed-native-queryelementintheXML descriptor