Given the following stateful session bean:
10.
@Stateful
11.
@TransactionAttributefJransactionAttributeType. SUPPORTS)
12.
public class VideoBean implements Video {
13.
// insert code here
14.
public void methodAO {}
15.}
Assuming no other transaction-related metadata, which code can be added at Line 13 to guarantee that business method methodA will execute only if invoked with an active transaction?
A. @TransactionAttributefJ
B. @TransactionManagement(TransactionAttributeType. CONTAINER)
C. @TransactionAttribute(TransactionAttributeType.MANDATORY)
D. @TransactionAttributeO"ransactionAttributeType.REQUIRES_NEW)
The ejb-jar file format is a contract between which two EJB role pairs? (Choose two.)
A. Deployer and System Administrator
B. Application Assembler and Deployer
C. Bean Provider and Application Assembler
D. Bean Provider and EJB Container Provider
E. EJB Server Provider and EJB Container Provider
F. Application Assembler and EJB Container Provider
A developer wants to create a business interface for both local and remote usage. For performance reasons the remote interface should NOT be called by a client in the same JVM. Which statement is required to accomplish this, assuming there is no deployment descriptor?
A. The business methods are defined in one interface which must be annotated with both @Local and @Remote.
B. The business methods are defined twice in one interface. One method is annotated with @Local and the other is annotated with @Remote.
C. The business methods are defined in a common interface by two other interfaces which are annotated with @Local and @Remote respectively. The bean implements the super interface.
D. The business methods are defined in a common interface. It is extended by two interfaces, annotated with @l_ocal and @Remote respectively. Both interfaces are implemented by the bean class.
Which statement is true about the Timer service in an EJB 3.0 stateless session bean?
A. The timeout callback method contains the business logic that handles the timeout event.
B. The timeout callback method must be declared as a business method in business interfaces.
C. The timeout callback method can throw application exceptions to report business logic failures.
D. A bean class can implement multiple timeout callback methods, each associated with a different timer.
A Java Persistence application uses a Version attribute to manage concurrent updates. Which is true?
A. The Version attribute must have a public access type.
B. The Version attribute is used by the persistence provider.
C. A separate Version attribute must be specified for each class in the inheritance hierarchy.
D. A separate Version column must be specified for each table mapped to the entity.
A developer wants to create a Java Persistence query to perform a bulk update operation on five different entity classes. All of these classes have a field called name. These classes have the following relationships:
Harrier extends Dog and Dog extends Animal
Vet extends Doctor
What is the minimum possible number of operations required to change the value of the name field for all of the entities in all five classes?
A. 1
B. 2
C. 3
D. 4
E. 5
FooBean is an EJB 3.0 session bean that can make valid use of UserTransaction. Which is guaranteed to work in an EJB container for FooBean to obtain the UserTransaclion object?
A. Invoke a method on a SessionContext that returns a UserTransaction object.
B. Perform JNDI lookup with name "java:/UserTransaction" on an InitialContext.
C. Perform JNDI lookup with the name "jdbc/UserTransaction" on an InitialContext.
D. Use the @TransactionManagement annotation to inject an instance variable of type UserTransaction in a bean class.
A developer wants to create a portable EJB 3.0 application that includes the following class definition for the Entity Account: 11.©Entity
12.
@Entityl_isteners(com. acme.AlertMonitor. class)
13.
public class Account {
14.
// more code here
15.
@PrePersist
16.
protected void validateCreate0 {/* more code here */} 17.} Which statement is correct?
A. The validateCreate method may NOT throwruntimeexceptions.
B. ThevalidateCreate method can invoke the EntityManager.flush operation.
C. Methods oftheclass com.acme.AlertMonitor annotatedwithcallback annotationsmusttake an Object or Account instance astheonly argument.
D. The above class definition is NOT correct. An entity cannot defineacallback methodlike PrePersistand use the EntityListeners annotationatthe same time.
Given:
A stateless session bean's business method invokes EJBContext.setRollbackOnly and receives an Illegal StateExe option. Under which of these conditions could this be possible?
A. The business method is marked with the MANDATORY transaction attribute.
B. The business method is marked with the NONSUPPORTED transaction attribute.
C. This is NOT possible; a stateless session bean cannot invoke EJBContext.setRollbackOnly.
D. The bean has no metadata (in annotations or deployment descriptor) which specifies the transaction attribute for the method.
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. Themethod will return FALSE.
C. Themethodwill throw an exception.
D. TheOrder instance willberemoved from the database.