1Z0-898 | The Secret of Oracle 1Z0-898 examcollection


Q11. Given two entities with one to-one association: 

Which code fragment correctly defines the detail field that PersonDetail instance in removed if the person instance that references it is removed? 

A. @OneToOne (optional = false) 

personDetail detail; 

B. @OneToOne (optional = false) 

@mapsId 

PersonDetail Detail; 

C. @ OneToOne (orphanremoval = true) 

PersonDetail Detail; 

D. @ OneToOne (cascade = ORPHAN _ DELETE) 

@mapsId 

PersonDetail detail; 

Answer:

Q12. The developer has defined the following entity class office: 

Which of the following attributes will be in corresponding generated static metamodel class for the rooms’ field? 

A. Public static volatile CollectionAttribute<Room> rooms; 

B. Public static volatile ListAttribute<Room> rooms; 

C. Public static volatile ListAttribute<Office, Room> rooms; 

D. Public static volatile SingleAttribute<Room> rooms; 

Answer:

Q13. A developer wants to ensure that an entity's data is up-to-date with regard to the database. Which of the following statements is guaranteed to accomplish this? 

A. Call EntityManager.refresh on the entity. 

B. Add acacheable (false) annotation on the entity class. 

C. Call EntityManager.find on the entity. 

D. Use a named query to retrieve the entity. 

Answer:

Q14. Which statement is true about the @OrderColumn annotation? 

A. If mime is not specified, it defaults to the foreign key column. 

B. The OrderColumn annotation may be specified only on a relationship. 

C. The OrderColumn annotation is always specified on the owning side of a relationship. 

D. The order column is not visible as part of the state of the entity. 

Answer:

Q15. A developer wants to write a type-safe Criteria API query. Which two of the following statements true about Criteria query roots? (Choose two) 

A. The query MUST define a query root. 

B. The query MUST define a query root only if it navigates to related entities. 

C. The query MUST NOT define multiple query roots. 

D. The query may define multiple query roots. 

Answer: BC 

Q16. Persistence application locks entity x with a LockModeType. PESSIMISTIC_READ lock type, which statement is true? 

A. This operation will force serialization among transactions attempting to read the entity data. 

B. This operation will result in a TransactionRolledbackException if the lock cannot be obtained. 

C. If the application later updates the entity, and the changes are flushed to the database, the lock will be converted to an exclusive lock. 

D. LockModeType. PESSIMISTIC_READ is the synonym of the LockModeType.READ. 

Answer:

Q17. The Contact Information embeddable class contains address information as well as a reference to a phone entity. The ContactInformation class is defined as follows: 

@Embeddable public class ContactInformation { 

String street; 

String city; 

@OneToOne Phone phone; 

The developer wants to use this class in an Employee entity, but override the default name of the foreign key to the Phone entity. Which of the code segments shows how to do this correctly? 

A. @Entity public class Employee { 

@Id int empId; 

@AssociationOverride (name = empInfo.phone”, joinColumn = @JoinColumn) 

(name = “INFO_FK”)) 

ContactInformation empInfo; 

B. @AssociationOverride (name = “empInfo.phone”, joinColumn = “INFO_FK”) 

@Id int empId; 

@ContactInformation empInfo; 

C. @ AssociationOverride (name = “empInfo.phone”, joinColumn = “INFO_FK”) 

Entity public class Employee { 

@Id int empId; 

D. Entity public class Employee { 

@Id int empId; 

@ AssociationOverride (name = “empInfo.phone”, joinColumn = “INFO_FK”) 

ContactInformation empInfo; 

Answer:

Q18. An application creates a TypedQuery object to perform a query, and sets the query object’s flush mode by calling setFlushMode (FlushModeType.commit). The query is executed within a transaction. 

Which of the following is true? 

A. Updates to the database tables may occur anytime during the transaction associated with the query. 

B. Updates to the entities that can affect the outcome of the query cannot be flushed to the database until the transaction commits. 

C. Changes to the entities in this transaction cannot be flushed to the database until the transaction commits. 

D. setFlushMode cannot be called on a TypedQuery object. 

Answer:

Q19. Consider a persistence application with the following orm.xml: 

What will be the effect of the above orm.xml? 

A. The access type for only those entities that have not explicitly specified @Access will be defaulted to field. 

B. The access type for all entities in the persistence unit will be changed to FIELD. 

C. The access type for allentities specified in this orm.xmlwill be changed to FIELD. 

D. The access type for only those entities defined in thisorm-xml for which access is notspecified will be defaulted to FIELD. 

Answer:

Q20. Which cascade option can be specified in a mapping descriptor so that it applies to all relationships in a persistent e unit? 

A. cascade all 

B. cascade detach 

C. cascade remove 

D. cascade-persist 

Answer: