java - get all results the same as the first items which have the same id -


see picture first. result want showing on web! correct result

however, different result shows same data first item wrong one

for example, wrong 1 top 5 results.

employee id crse id class sec   class mtg nbr   strm    descr  0010054 006833  01  1   2163    polynesian drum ensemble  0010054 006833  01  1   2163    polynesian drum ensemble  0010846 002668  01  1   2163    social welfare policy  0010846 002668  01  1   2163    social welfare policy  0010846 002668  01  1   2163    social welfare policy 

the result should

0010054 006833  01  1   2163    polynesian drum ensemble  0010054 006833  01  2   2163    polynesian drum ensemble  0010846 002668  01  1   2163    social welfare policy  0010846 001672  01  1   2163    non-gov prog develop  0010846 006423  01  1   2163    social research methods 

i don't know why computer first value of each emplid not every value of whole emplid.

these codes have. please me check goes wrong. thanks!

controller

private psinstrclassdao psinstrclassdao; private pscurtermdao pscurtermdao;  public void setpsinstrclassdao(psinstrclassdao psinstrclassdao) {     this.psinstrclassdao = psinstrclassdao; }  public void setpscurtermdao(pscurtermdao pscurtermdao) {     this.pscurtermdao = pscurtermdao; }  @requestmapping(value = {""}, method = requestmethod.get) public string getfacultyhome(model model) {      list<psinstrclass> facultylist = psinstrclassdao.list();      model.addattribute("faculty", facultylist);      list<pscurterm> termlist = pscurtermdao.list();      model.addattribute("term", termlist);      return "faculty"; } 

psinstrclassdao

@suppresswarnings("unchecked") @transactional public list<psinstrclass> list() {     entitymanager em = psentitymanagerfactorylistener.createentitymanager();     list<psinstrclass> faculty = null;      try {         faculty = em.createquery("select instr psinstrclass instr, pscurterm term "                                 + "where instr.strm = term.strm").getresultlist();     } catch (exception e) {         logger.error("error getting instrclass list", e);     } {         if (em != null) {             em.close();         }     }      return faculty; } 

jsp

<table border="1"> <tr>     <td>employee id</td>     <td>crse id</td>     <td>class sec</td>     <td>class mtg nbr</td>     <td>strm</td>     <td>descr</td> </tr> <c:foreach items="${faculty}" var="facultyitem">     <tr>         <td>${facultyitem.emplid}</td>         <td>${facultyitem.crseid}</td>         <td>${facultyitem.classsec}</td>         <td>${facultyitem.classmtg}</td>         <td>${facultyitem.strm}</td>         <td>${facultyitem.descr}</td>     </tr> </c:foreach>