Java userobjs无法解析为变量

Java userobjs无法解析为变量,java,Java,我收到此错误。返回类型不匹配 public List<EmpRecord> Empdata(String uname) throws Exception { System.out.println("Inside into service class2"); try { @SuppressWarnings("unchecked") List<EmpRecord> userObjs = hibernateTe

我收到此错误。返回类型不匹配

public List<EmpRecord> Empdata(String uname) throws Exception {
    System.out.println("Inside into service class2");

     try {
             @SuppressWarnings("unchecked")
           List<EmpRecord> userObjs = hibernateTemplate.find("from EmpRecord u  where u.uname=? ",uname);

             if(userObjs.size() != 0) {
                     System.out.println(" Employee Name : " + userObjs.get(0).getEmpName());

             }
         return userobjs;
public List Empdata(字符串uname)引发异常{
System.out.println(“内部到服务类2”);
试一试{
@抑制警告(“未选中”)
List userObjs=hibernateTemplate.find(“从EmpRecord u,其中u.uname=?”,uname);
如果(userObjs.size()!=0){
System.out.println(“员工姓名:+userObjs.get(0.getEmpName());
}
返回userobjs;

键入错误。仅此而已。在return语句中的userObjs中使用大写O

return userObjs;
更改为return
return userObjs;


出于安全原因,我还将
if(userObjs.size()!=0)
更改为
if(userObjs!=null&&userObjs.size()!=0)

或if(userObjs!=null&&!userObjs.isEmpty())?我看不到任何错误,只需编写代码…你能把错误放在你的问题中吗?