利用MyEclipse开发Struts+Hibernate应用 点击下载
其中文章中有个小的错误:
VipService.java中所有关闭session的地方有个小问题,还是需要通过SessionFactory来关闭。
之前代码:
if (session != null)
{
try
{
session.close();
}
catch (HibernateException e)
{
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}
}
修改之后:
try {
SessionFactory.closeSession();
} catch (HibernateException e) {
System.err.println("Hibernate Exception" + e.getMessage());
throw new RuntimeException(e);
}