Schema: each Employee may have many phone numbers and each phone number belongs to an Employee (a one-to-Many Relationship).
Using the following JPQL query: SELECT e, p FROM Employee e JOIN e.phones p,
How would you handle the resulting List<Object[]> from this query in your application code? In terms of accessing each employee and his/her phone number in the app. Code from that List<Object[]>? Using
em.createNamedQuery("..").getResultList().get(1)[]
// or
em.createNamedQuery("..").getResultList().get(2)[0]
results in error.
createNamedQueryandgetResulListin the code above. Does your actual code even compile?results in error- you might want to elaborate on the exact error you get.