Hibernate 中的根异常是什么? 我需要处理我的方法中的所有异常。 DataAccessException、HibernateException、PersistenceException 还是 HibernateException?
最佳答案
下面是 hibernate 异常层次结构。
java.lang.Object
extended by java.lang.Throwable
extended by java.lang.Exception
extended by java.lang.RuntimeException
extended by org.hibernate.HibernateException
下面是 HibernateException 的直接已知子类:
AuditException, BatchFailedException, CacheException, CallbackException, IdentifierGenerationException, InstantiationException, JDBCException, LazyInitializationException, MappingException, MultipleBagFetchException, NonUniqueObjectException, NonUniqueResultException, OptimisticLockException, PersistentObjectException, PropertyAccessException, PropertyValueException, QueryException, SerializationException, SessionException, StaleStateException, TooManyRowsAffectedException, TransactionException, TransientObjectException, TypeMismatchException, UnknownProfileException, UnresolvableObjectException, ValidationFailure, WrongClassException
您可以使用 super 家长说
Exception
要处理一般情况下的异常,对于特定的 hibernate ,您可以使用
HibernateException
有关更多详细信息,您可以引用 - HibernateException hierarchy
关于java - Hibernate中的根异常是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49727000/