我有这段代码:
} catch (HibernateException e) {
loginAnswer = new LoginCustomerAreaAnswer(999);
//This function use the error code save inside loginAnswer
this.logOp.error(logsUtilities.logException(e, "HibernateException"));
} catch (Exception e) {
loginAnswer = new LoginCustomerAreaAnswer(997);
//This function use the error code save inside loginAnswer
this.logOp.error(logsUtilities.logException(e, "Exception"));
} finally {
return loginAnswer;
}
如您所见,我首先捕获 HibernateException 类型异常,然后捕获泛型异常。
但是当我查看日志文件时,当我有一个 org.hibernate.exception.GenericJDBCException 异常时,它就像一个通用异常一样被捕获!
为什么? GenericJDBCException 它不是 HibernateException 的“儿子”?不必被 HibernateException 捕获?
这是我的日志文件的示例
2013-05-21 11:01:02 [Level: ERROR]*** Exception: Error code: 997 - Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
我真的迷路了,有人可以帮助我吗?