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

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -