select from two tables using JPQL
问题 I'm using JPQL to retrieve data. I can get data using the statement List persons = null; persons = em.createQuery("select p.albumName from PhotoAlbum p , Roleuser r where r = p.userId and r.userID = 1"); Now I can get the album names using this: int i=0; for (i=0;i<persons.size(); i++) { System.out.println("Testing n "+ i +" " + persons.get(0)); } Now I want to get the album name and the roleuser's row named firstname I'm using the query persons = em.createQuery("select r.firstName , p