【发布时间】:2020-03-21 15:53:24
【问题描述】:
嘿嗨,这是我的服务层代码
BillType billType=billTypeList.get(i);
这是我的 dao 代码:
@Override
public List<BillType> getBillTypeList(BillCategory billCategoryId){
Session session = null;
List<BillType> billTypeList=null;
try {
session=sessionFactory.openSession();
String sql = "select * from BILL_TYPE where BILL_CATEGORY_ID=:billCategoryId";
Query query = session.createSQLQuery(sql);
query.setParameter("billCategoryId", billCategoryId);
billTypeList= query.list();
}
catch(Exception e)
{
e.printStackTrace();
logger.error("Error in Method getBillType "+e.getMessage());
}
finally {
if (session != null) {
if (session.isOpen())
session.close();
}
}
return billTypeList;
}
这是我得到的错误:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.mppmcl.nonpower.model.BillType
请告诉我该怎么做。会有很大帮助。提前致谢
【问题讨论】:
标签: spring-mvc