spring-orm

org.springframework.orm.hibernate4
Class HibernateExceptionTranslator

java.lang.Object
  extended by org.springframework.orm.hibernate4.HibernateExceptionTranslator
All Implemented Interfaces:
org.springframework.dao.support.PersistenceExceptionTranslator
Direct Known Subclasses:
LocalSessionFactoryBean

public class HibernateExceptionTranslator
extends java.lang.Object
implements org.springframework.dao.support.PersistenceExceptionTranslator

PersistenceExceptionTranslator capable of translating HibernateException instances to Spring's DataAccessException hierarchy.

Extended by LocalSessionFactoryBean, so there is no need to declare this translator in addition to a LocalSessionFactoryBean.

When configuring the container with @Configuration classes, a @Bean of this type must be registered manually.

Since:
3.1
Author:
Juergen Hoeller
See Also:
org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor, SessionFactoryUtils.convertHibernateAccessException(HibernateException)

Constructor Summary
HibernateExceptionTranslator()
           
 
Method Summary
protected  org.springframework.dao.DataAccessException convertHibernateAccessException(org.hibernate.HibernateException ex)
          Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy.
 org.springframework.dao.DataAccessException translateExceptionIfPossible(java.lang.RuntimeException ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HibernateExceptionTranslator

public HibernateExceptionTranslator()
Method Detail

translateExceptionIfPossible

public org.springframework.dao.DataAccessException translateExceptionIfPossible(java.lang.RuntimeException ex)
Specified by:
translateExceptionIfPossible in interface org.springframework.dao.support.PersistenceExceptionTranslator

convertHibernateAccessException

protected org.springframework.dao.DataAccessException convertHibernateAccessException(org.hibernate.HibernateException ex)
Convert the given HibernateException to an appropriate exception from the org.springframework.dao hierarchy.

Parameters:
ex - HibernateException that occured
Returns:
a corresponding DataAccessException
See Also:
SessionFactoryUtils.convertHibernateAccessException(org.hibernate.HibernateException)

spring-orm