Oracle 1Z0-898 Online Practice
Questions and Exam Preparation
1Z0-898 Exam Details
Exam Code
:1Z0-898
Exam Name
:Java EE 6 Java Persistence API Developer Certified Expert
Certification
:Oracle Certifications
Vendor
:Oracle
Total Questions
:63 Q&As
Last Updated
:Dec 12, 2021
Oracle 1Z0-898 Online Questions &
Answers
Question 21:
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.
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.
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.
C. The persistence context exists until the EntityManagerinstance is closed.
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.
C. Changes to the entities in this transaction cannot be flushed to the database until the transaction commits.
Question 24:
Which of the following Criteria query snippets demonstrates the correct way to create and execute strongly typed queries? Assume that cb references an instance of the CriteriaBuilder interface and em references an EntityManager instance.
A. CriteriaQuery cq = cb.createQuery (Office.class); . . . TypedQuery tq = em.ceateQuery (cq) ; L 1st offices = tq.getResultList (); B. CriteriaQuery cq = cb.createQuery (Office.class) . . . TypedQuery tq = em.createQuery (cq, office.class); List offices = tq.getresult (); C. CriteriaQuery cq = em.createQuery (cq, office.class); . . . TypedQuery tq = em.createQuery (cq); List offices = tq.getresult (); D. CriteriaQuery cq = cb.createQuery (Office.class); . . . TypedQuery tq = em.ceateQuery (cq); List Offices = tq.getResultList ();
D. CriteriaQuery cq = cb.createQuery (Office.class); . . . TypedQuery tq = em.ceateQuery (cq); List Offices = tq.getResultList ();
The developer wants to write a criteria query that will return the number of orders made by customer of each county.
Assume that customer is an entity with a unidirectional one-to-many relationship to the Order entity and that Address is an embeddable class, with an attribute country of type String.
Which one of the queries below correctly achieves this?
A. CriteriaBuilder cb> = ... CriteriaQuery cq = cb.createQuery(); Root c = cq.from(Customer.class); Join o = c.join(Customer_.orders); cq.multiselect(cb.count(0), c,get(customer_.address.get(address_.country) cq.groupBy (c.get(customer_.address) .get(address_.country)) B. CriteriaBuilder cb> = ... CriteriaQuery cq = cb.createQuery(); Root c = cq.from(Customer.class); cq.select (cb.count(c.join (customer_. Orders)) , c.get(customers(0), c.get(customer_.address) . get (Address_'country)); (c.get(Customer_.address). get(address_.country)); C. CriteriaBuilder cb> = ... CriteriaQuery cq = cb.createQuery(); Root c = cq.from(Customer.class); Join o = c.join(Customer_.orders); cq.select(cb.count(o)); cq.groupBy(c.qet(Customer .address) - get(Address_.country)) ; D. CriteriaBuilder cb = ... CriteriaQuery cq = cb.createQueryO; Root c = cq.from(Customer.class); Root c = cq . from (Customer . class ) ,- Join o = c.join(Customer_.orders); Join country= c.join(Customer,.address) .join(Address cq.multiselect(cq.count(o), country ); cq.groupBy(c.get(Customer.address)- get (Address_ . country) ) ;
A. CriteriaBuilder cb> = ... CriteriaQuery cq = cb.createQuery(); Root c = cq.from(Customer.class); Join o = c.join(Customer_.orders); cq.multiselect(cb.count(0), c,get(customer_.address.get(address_.country) cq.groupBy (c.get(customer_.address) .get(address_.country))
The developer is creating a Java Persistence model for a legacy database. The database contains customer and subscriptions.
The subscriptions table has a foreign key to the Customer table, a foreign key to the magazines table, and a column that stores a java.util.Date (the subscription expiration date).
The developer wants to create entities Customer and subscription to model these tables and to represent the relationship between customer and subscription as a java.util.Map.
Which one of the following fields of the Customer entity accomplishes this task?
A. @OneToMany @joinColumn (name = "Customer - FK") Map subscriptions; B. @ElementaryCollection Map subscriptions C. @OneToMany @JoinTable (name = "Subscriptions") Map subscriptions; D. @ElementaryCollection @CollectionTable (name = "subscriptions") Map subscriptions E. @ElementaryCollection @CollectionTable (Name = "Subscriptions") @Temporal (TemporalType.DATE) Map subscriptions
C. @OneToMany @JoinTable (name = "Subscriptions") Map subscriptions;
Question 27:
Given two entities with many-to-many bidirectional association between them:
A. @manyToMany on the projects field, @manyToMany (mappedBy= "projects") on the emps field B. @manyToMany (mappedBy = emps) on the projects field, @manyToMany on the emps field C. @manyToMany ()targetEntity = project.class) on the projects field, @manyToMany (mappedBy = "projects") on the emps field D. @manyToMany (targetEntity = Project.class) on the projects field, @manyToMany on the emps field
D. @manyToMany (targetEntity = Project.class) on the projects field, @manyToMany on the emps field
Question 28:
Given:
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.
C. The method will throw an exception.
Question 29:
The embeddable class ContractInformation is used in an element collection of the Employee entity.
@Entity
Public class Employee {
@Id int empId;
@ElementaryCollection Set 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 phones; B. @Embeddable Address address; C. @ManyToOne phone phone; D. @ElementaryCollection phones; E. @OneToOne Address address;
A. @OneToMany Set phones; B. @Embeddable Address address;
Question 30:
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.
D. The access type for only those entities defined in thisorm-xml for which access is notspecified will be defaulted to FIELD.
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-898 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.