明明已经采用了泛型写法,为什么在MyEclipse中还是提示如下警告
来源:百度知道 编辑:UC知道 时间:2024/06/03 06:25:05
public List<Attend> findAll()
{
return (List<Attend>)getHibernateTemplate().find("from Attend");
}
明明已经采用了泛型写法,为什么在MyEclipse中还是提示如下警告:
Type safety: Unchecked cast from List to List<Attend>
{
return (List<Attend>)getHibernateTemplate().find("from Attend");
}
明明已经采用了泛型写法,为什么在MyEclipse中还是提示如下警告:
Type safety: Unchecked cast from List to List<Attend>
没有对List强制转换为List<Attend> 进行检查
如果你能确定检索结果是List<Attend> 类型,可以不予理会,或者关掉这种警告
改如下:
return (List<Attend>)(getHibernateTemplate()).find("form Attend");