java - How to retrieve many columns using jpql? -


i have problem retrieving info class.

@entity public class absence { @id @generatedvalue(strategy= generationtype.identity) private int absenceid; private int crn; private int studentid; @temporal(temporaltype.date) private date absencedate; 

}

i want retrieve following information : studentid, student name ,number of absences. problem query doesn't work. query using

public list<studentabsencesummary> getsetionabsences(int crn) { query q=em.createquery("select b.studentid,count(b.studentid)   absence b              b.crn =:crn group (b.studentid)")             .setparameter("crn", crn);     list<studentabsencesummary> students =q.getresultlist();     return students; } 

the class of retrieved list

public class studentabsencesummary { private int studentid; private string name; private int absencecount; 


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -