Which query can be used to return the user that holds the book titled "Java"?

A User entity is in a one-to-many relationship with a Book entity. Assume that a developer has a
function fetchBook(String title) that fetches a Book entity with the given title title.
Also assume that the developer has an entity manager em. Which query can be used to return the
user that holds the book titled “Java”?

A User entity is in a one-to-many relationship with a Book entity. Assume that a developer has a
function fetchBook(String title) that fetches a Book entity with the given title title.
Also assume that the developer has an entity manager em. Which query can be used to return the
user that holds the book titled “Java”?

A.
em.createQueryfSELECT u FROM User u where :great IN
u.books.title”).setParameter(“great”,”Java”)

B.
em.createQuery(“SELECT u FROM User u where :great IN

C.
books”). setParameter(“great”,fetchBook(“Java”))

D.
em.createQuery(“SELECT u FROM User u where :great MEMBER OF

E.
books.title”). setParameter(“great” .”Java”)

F.
em.createQuery(“SELECT u FROM User u where :great MEMBER OF

G.
books”). setParameter(“great”,fetchBook(“Java”))



Leave a Reply 0

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