我把原来的项目jdk从原来的1.8更换到1.7之后,更换了项目里面里面的build path以及java Compiler等,在dao层hibernate中使用query.setParameter仍然报错并提示bulid path
@Override
public int findDepartId(String d_name) {
Session session = HibernateUtils.getSession();
int intValue=0;
String hql = "select d_id from Department where d_name=:name";
Query query = session.createQuery(hql);
query.setParameter("name", d_name);
intValue = ((Number) query.uniqueResult()).intValue();
session.close();
return intValue;
}
不过当我修改方法成setString可以编译,但是运行时报java.lang.NoClassDefFoundError: Could not initialize class com.wh.dao.impl.HibernateUtils
错误