Which two are valid queries that return this information?

A User entity is in a one-to-many relationship with a Book entity. In other words, a developer can
reach the collection of books that a User instance myUser has by using the path
expression”myUser.books”. A developer wants to write a Java Persistence query that returns all
users that have only two books. Which two are valid queries that return this information? (Choose
two.)

A User entity is in a one-to-many relationship with a Book entity. In other words, a developer can
reach the collection of books that a User instance myUser has by using the path
expression”myUser.books”. A developer wants to write a Java Persistence query that returns all
users that have only two books. Which two are valid queries that return this information? (Choose
two.)

A.
SELECTu FROM UseruWHERESIZE(u.books) = 2

B.
SELECT u FROM UseruWHERE COUNT(u. books) = 2

C.
SELECT u FROM User u WHERE(SELECT COUNT(b)FROM u.books b) = 2

D.
SELECTuFROMUser uWHERE (SELECT SIZE(b) FROM u.booksb)= 2



Leave a Reply 0

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