利用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);
}
博客指出VipService.java中关闭session存在问题,原代码直接用session.close()关闭,修改后通过SessionFactory.closeSession()关闭,同时处理了HibernateException异常。
297

被折叠的 条评论
为什么被折叠?



