Valid 1Z0-898 Dumps shared by ExamDiscuss.com for Helping Passing 1Z0-898 Exam! ExamDiscuss.com now offer the newest 1Z0-898 exam dumps, the ExamDiscuss.com 1Z0-898 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com 1Z0-898 dumps with Test Engine here:
A developer is writing an application with three java Persistence API entities: order, customer, and Address. There is a many-to-one relationship between order and customer, and a one to-many relationship between customer and Address. Which two Criteria queries will return the orders of all customers who have an address whose value specified by the String parameter postalcode? (Choose two)
Correct Answer: A,D
Explanation/Reference: A: Join Order and Customer and join Customer and Address. Works fine. Not B: Chained joined not set up correctly. C: Join Order and Address through first joining Order and Customer. Not D: Cannot Join Order Address it just one single join. Need to chain the join. Note: Querying Relationships Using Joins For queries that navigate to related entity classes, the query must define a join to the related entity by calling one of the From.join methods on the query root object or another join object. The join methods are similar to the JOIN keyword in JPQL. The target of the join uses the Metamodel class of type EntityType<T> to specify the persistent field or property of the joined entity. The join methods return an object of type Join<X, Y>, where X is the source entity and Y is the target of the join. In the following code snippet, Pet is the source entity, Owner is the target, and Pet_ is a statically generated metamodel class: CriteriaQuery<Pet> cq = cb.createQuery(Pet.class); Root<Pet> pet = cq.from(Pet.class); Join<Pet, Owner> owner = pet.join(Pet_.owners); Joins can be chained together to navigate to related entities of the target entity without having to create a Join<X, Y> instance for each join: CriteriaQuery<Pet> cq = cb.createQuery(Pet.class); Root<Pet> pet = cq.from(Pet.class); Join<Owner, Address> address = cq.join(Pet_.owners).join(Owner_.addresses); Reference: Using the Criteria API and Metamodel API to Create Basic Typesafe Queries