1Z0-898 | how many questions of 1Z0-898 vce?


Q1. An application wants to utilize side effects of cascading entity manager operations to related entities. 

Which statement is correct? 

A. The persist operation is always cascaded to related entitles for one-to one and one-to-many relationships. 

B. To minimize the effect of the remove operation applied to an entity participating in a many-to-many relationship the remove operation should hecascadeto entities on both sides of the relationship. 

C. The persist operation applied to a new entity x is cascaded to entities referenced by x if the relationship from x to these other entities is annotated with the cascade=PERSIST or cascade=ALL annotation element value. 

D. The remove operation applied to a removed entity x is cascaded to entities referenced by x of the relationship from x to these other entities is annotated with the cascade = REMOVE of cascade = ALL annotation element value. 

Answer:

Q2. The embeddable class ContractInformation is used in an element collection of the Employee entity. 

@Entity 

Public class Employee { 

@Id int empId; 

@ElementaryCollection Set <ContractInformation> info; 

. . . 

Assume that the phone class is an entity and that address is an embedded class. 

Which two of the code segments below can be used to model the state of ContractInformation? (Choose two) 

A. @OneToMany Set <phone> phones; 

B. @Embeddable Address address; 

C. @ManyToOne phone phone; 

D. @ElementaryCollection <Phone> phones; 

E. @OneToOne Address address; 

Answer: AB 

Q3. A stateless session bean's business method invokes EJBContext.setRollBackOnly and receives an IllegalStateException. 

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 01 deployment descriptor) which specifies the transaction attribute for the method. 

Answer:

Q4. An application has two entities, parson and Address. 

The application calls the DeletePersonsByStatus named query. 

Which of the following is true? 

A. The person entities are removed, but NOT their related address entities. 

B. The person entities, and all their related address entities, are removed. 

C. The DeletePersonsByStatus named query is ill-formed, and will be rejected by the persistence provider. 

D. The named query will fall. 

Answer:

Q5. An application uses optimistic locking by defining version attributes in its entity classes. The application performs a bulk update of the entities using a JPQL query. 

Which of the following is correct? 

A. The persistence provider will ensure that the version value in each table is updated. 

B. The persistence provider will create a new transaction for the bulk update. 

C. An OptimisticLockException will be thrown by the persistence provider. 

D. The value of the Version attributes of the updated entitles should be also be explicitly updated by the query. 

Answer:

Q6. A JavaEE application is packaged as follows. 

Which of the following is true for a portable JavaEE application? 

A. This is an invalid application. A JavaEE application cannot have more than one persistent with same name. 

B. “MyPu” defined under each module is visible to only the defining module. There is no way other modules can access it. 

C. Code in the ejb1.jar can access “MyPU” defined under war1.war using “war1#myPU” 

Answer:

Q7. If an application uses an extended persistence context, which of the following is true? 

A. The persistencecontext exists until all transactions invoked by the EntityManager complete. 

B. The persistence context exists until all transactions invoked by the EntityManagar complete and the EntityManager.clear () method is invoked. 

C. The persistence context exists until the EntityManagerinstance is closed. 

D. The persistence context exists until the EntityManagerFactory instance is closed. 

Answer:

Q8. An application has three entities: the mapped superclass person class entity, and the parent and child entities, which are subclasses of person. 

The application has created four entity Instances: 

-Person1 is a Person entity with a primary key of 50 -Parent1is a Parent entity with a primary key of 100 -Child1 is a chi id entity with a primary key of 400 -Child2 is a child entity with a primary key of 600 

Caching has been enabled in the persistence unit, the persistence provider supports caching, and none of entities have the Cacheable annotation applied, or a cacheable XML element in persistence.xml. 

The application executes the following code: 

Cache cache = . . . ; 

Cache.evict(person.class) 

Boolean result = cache.contains (Child.class, 400); 

Assume there is no concurrent activity involving the cache. Which two statements are correct? (Choose two) 

A. Only person1 will be removed from cache. 

B. Person1, parent1, child1, and child2 will be removed from cache. 

C. Result is true 

D. Result is false 

Answer: AC 

Q9. A developer is creating an entity which is mapped to a table that has a primary key constraint defined on two character columns and would like to use mapping defaults as much as possible to simplify the code. 

Which two mapping options can be chosen? (Choose two.) 

A. Use an @id property that constructs a private field as a concatenation of two columns. 

B. Use a separate class to map those two columns and use an @idclass annotation to denote I primary key field or property in the entity. 

C. Use a separate @Embeddable class to map those two columns and use an @EmbeddedId annotation to denote a single primary key field or property in the entity. 

D. Use a separate @Embeddable class to map those two column and add two fields or properties the entity, each marked as @id, that correspond to the fields or properties in the embeddable class. 

E. Use a separate class to map those two columns. Specify that class using @Idclass annotation on the entity class. Add two fields or properties to the entity, each marked as @Id, that correspond to the fields or properties in that separate class. 

Answer: BC 

Q10. Consider the following web application: 

Here MyEntity1.class and MyEntity2.class are annotated with @Entity and MyEmbeddable1-class and MyEmbeddable2-class are annotated with @Embeddable. MyPU is container managed. Which of the following represents set of classes considered managed by MyPU? 

A. MyEntity1, and MyEmbeddable1 

B. MyEntity1, MyEmbeddable1, MyEntity2, and MyEmbeddable2 

C. MyEntity1, MyEmbeddable1, and MyEntity2 

D. MyEntity1 and MyEntity2 

Answer: