jpa - Incompatible types; found: interface java.util.List<java.lang.Object>, required: interface java.util.List<test.entity.Emp> -


i have following class structure

public class emp implements java.io.serializable {  ....  }  public interface employeedao  {   public list<emp> findallemployees();  }  public class employeedaoimpl  implements employeedao {      public list<emp> findallemployees() {         criteriaquery cq = getentitymanager().getcriteriabuilder().createquery();         cq.select(cq.from(emp.class));         return getentitymanager().createquery(cq).getresultlist();     } ...  } 

issue having is

return getentitymanager().createquery(cq).getresultlist(); 

the above line gives me following error, reason this?

incompatible types; found: interface java.util.list<java.lang.object>,  required: interface java.util.list<test.entity.emp> 

the same code works in other higher version of java. current jdk 1.6

you didn't tell criteraquery type return.

public list<emp> findallemployees() {     criteriaquery<emp> cq = getentitymanager().getcriteriabuilder().createquery(emp.class);     cq.select(cq.from(emp.class));     return getentitymanager().createquery(cq).getresultlist(); } 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -