hibernate.cfg.xml里面有没有把这个Course通过
"from Course where courseName='" + courseName + "'"; 这是几个意思???
public Cost findByName(String name) throws MessageException {
String hql = "from Cost where name=?";
Session session = HibernateUtil.getSession();
Query query = session.createQuery(hql);
query.setString(0, name);
Cost cost = (Cost) query.uniqueResult();
return cost;
}
这样写我认为比较好吧