java - Hibernate中的根异常是什么

标签 java hibernate

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/

相关文章:

java - 将 @Version 与 Envers 一起使用

java - 无法在 Play-Spring-Hibernate 应用程序中加载 ApplicationContext,获取 java.lang.ClassNotFoundException : org. w3c.dom.ElementTraversal

java - 没有主键和可为空字段的 Hibernate 实体

hibernate - Grails 更新 2.3.11-> 2.4.3 ClassNotFoundException : org. hibernate.cache.access.AccessType

java - Hibernate + C3p0 + mysql

java - 捕捉桌面图像

java - 将 double 值转换为 boolean 值时出现问题

java - HQL 和连接——更快的方法?

java - 在哪里可以下载 Java SE 的源代码(java.lang、java.util 等)?

java - TestNG 测试永远持续(但不总是)