0
私のメソッドにSQLGrammarExceptionを実装しようとしています。 このメソッドは、私に列のエラーを表示しますが、私はどのプロシージャにエラーがある列を表示する必要があります。メソッドにSQLGrammarExceptionを実装しようとします。
public static PersistenceMicrodataException dealHibernateException(Throwable e) {
e.printStackTrace();
Throwable t = ExceptionUtil.getCause(e);
return new PersistenceMicrodataException(t.getMessage(), t);
}
私はこれを試してみてください。
public static PersistenceMicrodataException dealHibernateException(Throwable e) {
try {
Throwable t = ExceptionUtil.getCause(e);
} catch (Exception e) {
System.out.println(t.getMessage());
System.out.println(((SQLGrammarException) t).getSQLState());
System.out.println(((SQLGrammarException) t).getErrorCode());
System.out.println(t.getCause());
}
return new PersistenceMicrodataException(e.getMessage(), e);
}
誰かがこれで私を助けることができますか?