Which of the following Criteria query snippets demonstrates the correct way to create and execute strongly typed queries?

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 <office> cq = cb.createQuery (Office.class);. . .TypedQuery<Office> tq = em.createQuery (cq);List <office> offices =cb.getResultList ();
B. CriteriaQuery cq = cb.createQuery (Office.class). . .TypedQuery<office> tq = em.createQuery (cq, office.class);List <office> offices = tq.getresult ();
C. CriteriaQuery<office> cq = em.createQuery (cq, office.class);. . .TypedQuery<Office> tq = em.createQuery (cq);List <office> offices = tq.getresult ();
D. CriteriaQuery <office> cq = cb.createQuery (Office.class);. . .TypedQuery<Office> tq = em.createQuery (cq);List<office> Offices = tq.getResultList ();

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.